https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126313
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2026-07-18
Status|UNCONFIRMED |NEW
Keywords|needs-bisection |
--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
ifcombine does:
optimizing two comparisons to _2 <= _8
Merging blocks 2 and 3
Which is bad.
# RANGE [irange] int [0, 255] MASK 0xff VALUE 0x0
_2 = (int) a.0_1;
if (_2 > 1)
goto <bb 4>; [59.00%]
else
goto <bb 3>; [41.00%]
<bb 3> [local count: 440234144]:
# RANGE [irange] int [0, 1] MASK 0x1 VALUE 0x0
_8 = (int) a.0_1;
if (_2 > _8)
goto <bb 4>; [50.00%]
else
goto <bb 5>; [50.00%]
So first it invokes:
(@0 <= @1 and @0 <= @2) to use min pattern.
to get:
_2 <= min(1, _8)
Which is fine.
And then min(1, _8) is transformed into:
`1 & _8`
because of ifcombine does not remove the "global" range on _8.
And then `1 & _8` is converted into just _8 because _8 has a range of [0,1].
So ifcombine needs to temporary remove the global ranges on the statements
inside the full bb before invoking match.