https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57359
--- Comment #24 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #22) > Created attachment 48311 [details] > patch > > Note that apart from the possible bad impact on optimization when fixing this > bug an actual fix is complicated by the custom "optimized" dependence > analysis > code in the loop invariant motion pass. > > A conservative "simple" patch would be the attached but that doesn't preserve > store-motion for the following (because the LIM data dependence code doesn't > care about stmt order): > > typedef int A; > typedef float B; > > void __attribute__((noinline,noclone)) > foo(A *p, B *q, long unk) > { > for (long i = 0; i < unk; ++i) { > q[i] = 42; > *p = 1; > } > } > > usually this bug doesn't manifest itself but of course the fix will be > experienced everywhere. Benchmarking the simple patch might reveal > it's not an issue (but I doubt that...). One case like this is gcc.dg/tree-ssa/pr81744.c which fails after the patch because we do not SM the global induction variable update which is already last before exit. Similarly gcc.dg/graphite/pr80906.c and gcc.target/i386/pr64110.c - that's all of the GCC testsuite fallout on x86_64. I do not think those regressions are acceptable on its own but I'll throw the patch on SPEC CPU 2006 to get more data (I fear even a solution preserving the cited regressions will regress actual code too much).