https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89497
--- Comment #27 from rguenther at suse dot de <rguenther at suse dot de> --- On Fri, 8 Mar 2019, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89497 > > --- Comment #26 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > More simplified testcase: > /* PR middle-end/89497 */ > > static unsigned long * > foo (unsigned long *x) > { > return x + (1 + *x); > } > > __attribute__((noipa)) unsigned long > bar (unsigned long *x) > { > unsigned long c, d = 1, e, *f, g, h = 0, i; > for (e = *x - 1; e > 0; e--) > { > f = foo (x + 1); > for (i = 1; i < e; i++) > f = foo (f); > c = *f; > if (c == 2) > d *= 2; > else > { > i = (c - 1) / 2 - 1; > g = (2 * i + 1) * (d + 1) + (2 * d + 1); > if (g > h) > h = g; > d *= c; > } > } > return h; > } > > int > main () > { > unsigned long a[18] = { 4, 2, -200, 200, 2, -400, 400, 3, -600, 0, 600, 5, > -100, -66, 0, 66, 100, __LONG_MAX__ / 8 + 1 }; > if (bar (a) != 17) > __builtin_abort (); > return 0; > } But when I look at the GIMPLE differences on x86_64 I see nothing besides BB and SSA numbering being slightly different at RTL expansion time. Possibly enough to trigger later RTL optimization issues of course. One key difference is a loop latch fallthru vs. non-fallthru for example. So I stand by the assertion the rev. just hides a problem elsewhere (on RTL I think).