Move "(A & C) == D is false when D & ~C != 0" to match.pd

H.J. Lu hjl.tools@gmail.com
Sat May 27 07:48:00 GMT 2017


On Sat, May 20, 2017 at 11:27 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
> Hello,
>
> as asked, I am adding some replacement in match.pd instead of just deleting
> this (redundant with CCP). It is not clear how general the match.pd version
> needs to be. (for instance it could handle some casts in addition to what I
> have written)
>
> The expansion results in a few non-canonical patterns (thus unreachable
> code), but avoiding them would make the code longer and less readable.
>
> I wondered about naming with_possible_nonzero_bits INTEGER_CST_or_SSA_NAME
> instead.
>
> I would like to rename get_nonzero_bits to get_possible_nonzero_bits or
> get_possibly_nonzero_bits, something more explicit, and introduce
> get_certain(ly)_nonzero_bits that would always return 0 for SSA_NAME for a
> start (but hopefully the next person who rewrites this stuff (merge CCP with
> VRP for instance?) will implement it). It would allow for more symmetry in
> the transformations and make the intent clearer.
>
> Bootstrap+testsuite on powerpc64le-unknown-linux-gnu.
>
> 2017-05-22  Marc Glisse  <marc.glisse@inria.fr>
>
>         * fold-const.c (fold_binary_loc) [(A & C) == D]: Remove
> transformation.
>         * match.pd (X == C): Rewrite it here.
>         (with_possible_nonzero_bits, with_possible_nonzero_bits2,
>         with_certain_nonzero_bits2): New predicates.
>         * tree-ssanames.c (get_nonzero_bits): Handle INTEGER_CST.
>
> --
> Marc Glisse

This caused:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80894


-- 
H.J.



More information about the Gcc-patches mailing list