https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112344
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ah, it reproduces (a local patch hides the issue, the bisected rev. likely just
exposes an existing issue).
We're optimizing this to
<bb 2> [local count: 16873086]:
<bb 3> [local count: 105119324]:
# c_31 = PHI <3(2), c_51(3)>
# ivtmp_28 = PHI <7(2), ivtmp_49(3)>
_48 = (unsigned char) c_31;
_50 = _48 + 10;
c_51 = (signed char) _50;
ivtmp_49 = ivtmp_28 + 4294967295;
if (ivtmp_49 != 0)
goto <bb 3>; [85.71%]
else
goto <bb 4>; [14.29%]
<bb 4> [local count: 16873086]:
d_52 = (short int) _50;
if (d_52 != 13)
and the issue is likely in final value replacement doing
final value replacement:
e_9 = PHI <e_17(3)>
with expr: (e_31 + 2) + (int) ((19 - (unsigned int) e_31) / 2) * 2
final stmt:
e_9 = _7 + _20;
final value replacement:
c_8 = PHI <c_18(3)>
with expr: (signed char) (((unsigned char) ((19 - (unsigned int) e_31) / 2) +
(unsigned char) c_25) + 1)
final stmt:
c_8 = (signed char) _33;
-fdisable-tree-sccp fixes this.