https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117574
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 --- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> --- for (g = 40; g != 124; g += 50) .optimized has d.3_5 = d; // 0 _6 = (int) d.3_5; _9 = _6 + 40; _10 = (long int) _9; // 40 _43 = (unsigned int) d.3_5; _23 = _43 + 41; _29 = (int) _23; _50 = _43 + 76; _39 = (int) _50; _18 = _29 >= _39; // 41 >= 76 _37 = _18 ? 1 : 368934881474191034; // 368934881474191034 _42 = (unsigned long) d.3_5; _41 = _37 * 50; // 84 _17 = _42 + 40; _38 = _17 + _41; // 124 _46 = (long int) _38; <bb 4> [local count: 955630224]: # g_33 = PHI <g_21(4), _10(3)> # b_lsm.12_28 = PHI <_20(4), b_lsm.12_30(3)> _20 = b_lsm.12_28 + g_33; g_21 = g_33 + 50; if (g_21 != _46) goto <bb 4>; [89.00%] it is IVCANON replacing the inner loop IV and thus in the end this looks like a niter issue. Before IVCANON we have d.3_5 = d; _6 = (int) d.3_5; _7 = _6 + 76; _8 = (long int) _7; _9 = _6 + 40; _10 = (long int) _9; <bb 6> [local count: 955630224]: # g_33 = PHI <g_21(15), _10(13)> # b_lsm.12_28 = PHI <_20(15), b_lsm.12_30(13)> _20 = b_lsm.12_28 + g_33; g_21 = g_33 + 50; if (_8 >= g_21) // 76 >= { 40, +, 50 } goto <bb 15>; [89.00%] else goto <bb 17>; [11.00%] <bb 15> [local count: 850510900]: goto <bb 6>; [100.00%] so we wrongly replaced a >= IV check with a != one, the generated code suggests a flipped condition somewhere: _18 = _29 >= _39; // 41 >= 76 _37 = _18 ? 1 : 368934881474191034; // 368934881474191034 with _18 = _29 <= _39 it would have been correct.