[Bug tree-optimization/105983] Failure to optimize (b != 0) && (a >= b) as well as the same pattern with binary and
cvs-commit at gcc dot gnu.org
Thu Jun 16 12:37:48 GMT 2022
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <email@example.com>:
Author: Jakub Jelinek <firstname.lastname@example.org>
Date: Thu Jun 16 14:37:06 2022 +0200
match.pd: Improve y == MIN || x < y optimization [PR105983]
On the following testcase, we only optimize bar where this optimization
is performed at GENERIC folding time, but on GIMPLE it doesn't trigger
anymore, as we actually don't see
(bit_and (ne @1 min_value) (ge @0 @1))
(bit_and (ne @1 min_value) (le @1 @0))
genmatch handles :c modifier not just on commutative operations, but
also comparisons and in that case it means it swaps the comparison.
2022-06-16 Jakub Jelinek <email@example.com>
* match.pd (y == XXX_MIN || x < y -> x <= y - 1,
y != XXX_MIN && x >= y -> x > y - 1): Use :cs instead of :s
on non-equality comparisons.
* gcc.dg/tree-ssa/pr105983.c: New test.
More information about the Gcc-bugs