Richard Biener <rguent...@suse.de> writes: > This patch decrements nb_iterations_upper_bound by one after we copied > the loop header. This allows niter + 1 to more often not overflow. > > Bootstrapped and tested on x86_64-unknown-linux-gnu, installed to trunk. > > Richard. > > 2013-11-21 Richard Biener <rguent...@suse.de> > > * tree-ssa-loop-ch.c (copy_loop_headers): Decrement > nb_iterations_upper_bound by one.
This seems to regress the following testcase, compiled at -O2 on x86_64-linux-gnu. Thanks, Richard void __attribute__ ((noinline)) f (long *s, long *t, int len1, int len2) { int i, j; j = 2; for (i = len1 - 1; i >= 0; i--) { s[j--] = (i < len2 ? t[i] : t[len2 - 1] < 0 ? -1 : 0); if (j < 0) break; } } long s[3]; long t[3]; int main (void) { t[0] = 1; t[1] = 2; t[2] = 3; f (s, t, 3, 3); if (memcmp (s, t, sizeof (s)) != 0) abort (); return 0; }