https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71366
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Ok, so it happens that we optimize away the backedge of the loop father when canonicalizing IVs in the inner loop which appears as <> # d_9 = PHI<2(7)> <header> # d_3 = PHI<d_9(6), d_11(5)> if (d_3 >= 0) ; else -> loop latch of outer loop There is a missed constant propagation from the CCP pass immediately before cunrolli as well. So we peel the loop based on undefinedness of a[0][d] in the last iteration. So we never take the d<0 exit to the latch of the outer loop which in turn prunes this edge. In fact it is removed as pointless in remove_redundant_iv_tests (optimized to 1 != 0) and then removed by to_remove edges marked by gimple_duplicate_loop_to_header_edge via remove_path which in turn adjusts stuff to eventually unloop outer loops (sth the pass doesn't really expect). In fact we carefully avoid doing this kind of stuff to the loop we unroll itself.