https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70935
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This is tree_unswitch_outer_loop -> hoist_guard not resetting debug stmts that have some uses of SSA_NAMEs defined in the inner loop. But the transformation is really weird. We have: loop7================== bb10 | v loop2 ============= />bb8 | inv test | / | | | something | \ | \ | v v \ | bb7 + | | | +---+ | loop2 end ========= | v bb13 DEBUG pm = defined_in_something And we move the inv test to bb 10, with one edge going to loop2, and the other to bb13 (newly added edge). If I understand the cfg right though, we've thus changed an endless loop (if inv test is false, bb8 not really having any side-effects just jumped to bb7 and back to bb8 forever) into no loop, and in addition the newly added edge from bb10 to bb13 of course means any SSA_NAMEs defined in loop2 can't be used.