https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526
--- Comment #6 from amker at gcc dot gnu.org --- (In reply to rdapp from comment #5) > I still don't quite get why the "n - 1" is needed. Do we need it to possibly > have an exit condition like > > if (i != n-1) or > if (i <= n-1)? > > Am I missing something really obvious here? The dump before ivopt is as below: <bb 2>: if (n_5(D) != 0) goto <bb 4>; else goto <bb 3>; <bb 3>: return; <bb 4>: <bb 5>: # i_18 = PHI <0(4), i_14(7)> _6 = (long unsigned int) i_18; _7 = _6 * 8; _9 = out_8(D) + _7; _11 = in_10(D) + _7; _12 = *_11; *_9 = _12; i_14 = i_18 + 1; i.0_4 = (unsigned int) i_14; if (i.0_4 < n_5(D)) goto <bb 7>; else goto <bb 6>; <bb 6>: goto <bb 3>; <bb 7>: goto <bb 5>; It comes from loop niter analysis, as in may_eliminate_iv, we have: (gdb) call debug_generic_expr(desc->niter) n_5(D) + 4294967295