https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67005
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- Note we already do /* If we made a BB unconditionally exit a loop then this transform alters the set of BBs in the loop. Schedule a fixup. */ if (loop_exit_edge_p (bb->loop_father, e)) loops_state_set (LOOPS_NEED_FIXUP); remove_edge (e2); thus this would need to add sth like || e2->flags & IRREDUCIBLE_LOOP