]> git.ipfire.org Git - thirdparty/gcc.git/commit
MATCH: Improve zero_one_valued_p for cases without range information
authorAndrew Pinski <apinski@marvell.com>
Thu, 14 Sep 2023 21:47:04 +0000 (14:47 -0700)
committerAndrew Pinski <apinski@marvell.com>
Fri, 15 Sep 2023 14:27:12 +0000 (07:27 -0700)
commitb975c0dc3be285655800180260c985bc97886f2e
tree94323163d71243400ed7c72f7d6cfb36b5cbb381
parentba4c1f2bfc9ec063188b39d0281fae04c57b1416
MATCH: Improve zero_one_valued_p for cases without range information

I noticed we sometimes lose range information in forwprop due to a few
match and simplify patterns optimizing away casts. So the easier way
to these cases is to add a match for zero_one_valued_p wich mathes
a cast from another zero_one_valued_p.
This also adds the case of `x & zero_one_valued_p` as being zero_one_valued_p
which allows catching more cases too.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

* match.pd (zero_one_valued_p): Match a cast from a zero_one_valued_p.
Also match `a & zero_one_valued_p` too.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/bool-13.c: Update testcase as we now do
the MIN/MAX during forwprop1.
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/bool-13.c