Re: [PATCH] jump: Change return type of predicate functions from int to bool

2023-05-31 Thread Bernhard Reutner-Fischer via Gcc-patches
On Wed, 31 May 2023 09:40:24 +0200
Uros Bizjak via Gcc-patches  wrote:

> On Wed, May 31, 2023 at 9:17 AM Richard Biener
>  wrote:

> > Do we have a diagnostic that would point out places we
> > assign the bool result to an integer variable?  Do we want
> > to change those places as well (did you intend to or restrict
> > the changes to functions only used in conditional context?)  
> 
> FWIW, I'm going through candidate files by hand, looking for predicate
> functions that return 0/1. The candidate files are the ones mentioned
> in rtl.h. In addition, I am doing some drive-by cleanups in candidate
> files.

I've scratched
https://inbox.sourceware.org/gcc-patches/20221112234543.95441-5-al...@gcc.gnu.org/
https://inbox.sourceware.org/gcc-patches/20221112234543.95441-6-al...@gcc.gnu.org/

to generate patches.
You had to manually adjust the declarations to match the patched
definitions, and i did not change the type of local variables feeding
into the return automatically.

But it helped find some low hanging fruit quickly.

HTH and cheers,


Re: [PATCH] jump: Change return type of predicate functions from int to bool

2023-05-31 Thread Uros Bizjak via Gcc-patches
On Wed, May 31, 2023 at 9:17 AM Richard Biener
 wrote:
>
> On Tue, May 30, 2023 at 9:01 PM Jeff Law via Gcc-patches
>  wrote:
> >
> >
> >
> > On 5/30/23 08:36, Uros Bizjak via Gcc-patches wrote:
> > > gcc/ChangeLog:
> > >
> > >  * rtl.h (comparison_dominates_p): Change return type from int to 
> > > bool.
> > >  (condjump_p): Ditto.
> > >  (any_condjump_p): Ditto.
> > >  (any_uncondjump_p): Ditto.
> > >  (simplejump_p): Ditto.
> > >  (returnjump_p): Ditto.
> > >  (eh_returnjump_p): Ditto.
> > >  (onlyjump_p): Ditto.
> > >  (invert_jump_1): Ditto.
> > >  (invert_jump): Ditto.
> > >  (rtx_renumbered_equal_p): Ditto.
> > >  (redirect_jump_1): Ditto.
> > >  (redirect_jump): Ditto.
> > >  (condjump_in_parallel_p): Ditto.
> > >  * jump.cc (invert_exp_1): Adjust forward declaration.
> > >  (comparison_dominates_p): Change return type from int to bool
> > >  and adjust function body accordingly.
> > >  (simplejump_p): Ditto.
> > >  (condjump_p): Ditto.
> > >  (condjump_in_parallel_p): Ditto.
> > >  (any_uncondjump_p): Ditto.
> > >  (any_condjump_p): Ditto.
> > >  (returnjump_p): Ditto.
> > >  (eh_returnjump_p): Ditto.
> > >  (onlyjump_p): Ditto.
> > >  (redirect_jump_1): Ditto.
> > >  (redirect_jump): Ditto.
> > >  (invert_exp_1): Ditto.
> > >  (invert_jump_1): Ditto.
> > >  (invert_jump): Ditto.
> > >  (rtx_renumbered_equal_p): Ditto.
> > >
> > > Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
> > >
> > > OK for master?
> > OK.
>
> Do we have a diagnostic that would point out places we
> assign the bool result to an integer variable?  Do we want
> to change those places as well (did you intend to or restrict
> the changes to functions only used in conditional context?)

FWIW, I'm going through candidate files by hand, looking for predicate
functions that return 0/1. The candidate files are the ones mentioned
in rtl.h. In addition, I am doing some drive-by cleanups in candidate
files.

Uros.


Re: [PATCH] jump: Change return type of predicate functions from int to bool

2023-05-31 Thread Richard Biener via Gcc-patches
On Tue, May 30, 2023 at 9:01 PM Jeff Law via Gcc-patches
 wrote:
>
>
>
> On 5/30/23 08:36, Uros Bizjak via Gcc-patches wrote:
> > gcc/ChangeLog:
> >
> >  * rtl.h (comparison_dominates_p): Change return type from int to bool.
> >  (condjump_p): Ditto.
> >  (any_condjump_p): Ditto.
> >  (any_uncondjump_p): Ditto.
> >  (simplejump_p): Ditto.
> >  (returnjump_p): Ditto.
> >  (eh_returnjump_p): Ditto.
> >  (onlyjump_p): Ditto.
> >  (invert_jump_1): Ditto.
> >  (invert_jump): Ditto.
> >  (rtx_renumbered_equal_p): Ditto.
> >  (redirect_jump_1): Ditto.
> >  (redirect_jump): Ditto.
> >  (condjump_in_parallel_p): Ditto.
> >  * jump.cc (invert_exp_1): Adjust forward declaration.
> >  (comparison_dominates_p): Change return type from int to bool
> >  and adjust function body accordingly.
> >  (simplejump_p): Ditto.
> >  (condjump_p): Ditto.
> >  (condjump_in_parallel_p): Ditto.
> >  (any_uncondjump_p): Ditto.
> >  (any_condjump_p): Ditto.
> >  (returnjump_p): Ditto.
> >  (eh_returnjump_p): Ditto.
> >  (onlyjump_p): Ditto.
> >  (redirect_jump_1): Ditto.
> >  (redirect_jump): Ditto.
> >  (invert_exp_1): Ditto.
> >  (invert_jump_1): Ditto.
> >  (invert_jump): Ditto.
> >  (rtx_renumbered_equal_p): Ditto.
> >
> > Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
> >
> > OK for master?
> OK.

Do we have a diagnostic that would point out places we
assign the bool result to an integer variable?  Do we want
to change those places as well (did you intend to or restrict
the changes to functions only used in conditional context?)

Richard.

> jeff


Re: [PATCH] jump: Change return type of predicate functions from int to bool

2023-05-30 Thread Jeff Law via Gcc-patches




On 5/30/23 08:36, Uros Bizjak via Gcc-patches wrote:

gcc/ChangeLog:

 * rtl.h (comparison_dominates_p): Change return type from int to bool.
 (condjump_p): Ditto.
 (any_condjump_p): Ditto.
 (any_uncondjump_p): Ditto.
 (simplejump_p): Ditto.
 (returnjump_p): Ditto.
 (eh_returnjump_p): Ditto.
 (onlyjump_p): Ditto.
 (invert_jump_1): Ditto.
 (invert_jump): Ditto.
 (rtx_renumbered_equal_p): Ditto.
 (redirect_jump_1): Ditto.
 (redirect_jump): Ditto.
 (condjump_in_parallel_p): Ditto.
 * jump.cc (invert_exp_1): Adjust forward declaration.
 (comparison_dominates_p): Change return type from int to bool
 and adjust function body accordingly.
 (simplejump_p): Ditto.
 (condjump_p): Ditto.
 (condjump_in_parallel_p): Ditto.
 (any_uncondjump_p): Ditto.
 (any_condjump_p): Ditto.
 (returnjump_p): Ditto.
 (eh_returnjump_p): Ditto.
 (onlyjump_p): Ditto.
 (redirect_jump_1): Ditto.
 (redirect_jump): Ditto.
 (invert_exp_1): Ditto.
 (invert_jump_1): Ditto.
 (invert_jump): Ditto.
 (rtx_renumbered_equal_p): Ditto.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

OK for master?

OK.

jeff