[patch] Fix PHI optimization issue with boolean types

Richard Biener richard.guenther@gmail.com
Mon Oct 24 11:49:00 GMT 2016

On Mon, Oct 24, 2016 at 1:39 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> > But integer_truep is just integer_onep for BOOLEAN_TYPEs.
>> Yes, but it's more descriptive IMHO.
> At the cost of consistency with fits_to_tree_p though.
>> fits_to_tree_p avoids creating an INTEGER_CST in ggc memory and thus is the
>> prefered way to test if you have a wide-int but not yet an INTEGER_CST.
> OK, I was confused by int_fits_type_p, which calls it on an INTEGER_CST (which
> now breaks with the additional test in the function).
> The attached fix seems to work and passes regression testing (all languages).

Is the change to pass wi::to_widest really necessary?  I think it has a
runtime penalty.

Otherwise ok.


>         * tree.h (wi::fits_to_tree_p): Accept only 0 and 1 for boolean types.
>         * tree.c (int_fits_type_p): Likewise.  Pass the integer constant as a
>         widest_int to above.
> --
> Eric Botcazou

More information about the Gcc-patches mailing list