https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70729
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- Oh, and I believe to make nests with only outer safelen > 0 work correctly we need to move the check elsewhere: Index: gcc/tree-ssa-loop-im.c =================================================================== --- gcc/tree-ssa-loop-im.c (revision 235237) +++ gcc/tree-ssa-loop-im.c (working copy) @@ -2120,6 +2120,12 @@ ref_indep_loop_p_1 (struct loop *loop, i bitmap_iterator bi; im_mem_ref *aref; + /* If the Ith and the I + nth iterations can be evaluated + concurrently a reference with an invariant address is + not dependent on any other memory reference. */ + if (loop->safelen > 0) + return true; + if (stored_p) refs_to_check = &memory_accesses.refs_in_loop[loop->num]; else