https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125774
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
CC| |pinskia at gcc dot gnu.org
Keywords|needs-bisection |
Last reconfirmed| |2026-06-13
Ever confirmed|0 |1
--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
So so it looks like:
_21 = lower_9 < _20;
_22 = lower_9 > _20;
Works but:
_21 = _20 > lower_9;
_22 = lower_9 > _20;
Does not.
So there are 2 issues here.
One is fold_using_range::relation_fold_and_or seems not to like non-Canonical
gimple.
The other is production of the non-Canonical gimple.
Looks like when ch did the copy of the header in 13 produced that non-canonical
gimple.
So what "fixed" it for GCC 14 is one of the loop ch improvements. As we no
longer copy the header.
I think what is happening is "reverse" is changeing `a > b` into `b <= a` which
is wrong.
if (reverse_op2)
relation2 = relation_negate (relation2);
This should have been swap. So I think this patch:
```
[apinski@xeond2 gcc]$ git diff gimple-range-fold.cc
diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index c3f720a786f..9dea0f64836 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -1570,7 +1570,7 @@ fold_using_range::relation_fold_and_or (irange&
lhs_range, gimple *s,
return;
if (reverse_op2)
- relation2 = relation_negate (relation2);
+ relation2 = relation_swap (relation2);
// x && y is false if the relation intersection of the true cases is NULL.
if (is_and && relation_intersect (relation1, relation2) == VREL_UNDEFINED)
```
Let me double check.