https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69989
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> --- So - we have an irreducible region that has a reducible part (a memset loop). The entry into that reducible part is marked as EDGE_IRREDUCIBLE_LOOP. Loop distribution re-directs the src of the exit of that reducible part (also marked irreducible) but ends up removing the entry. So we trigger the "redundant" (?) edge flag check (if the edge is part of an irreducible region both the src and dest should be marked irreducible as well). Now... with an embedded reducible sub-CFG that seems no longer true. Restricting ourselves to void remove_edge (edge e) { if (current_loops != NULL) { rescan_loop_exit (e, false, true); /* If we remove an edge that is part of an irreducible region or we remove an entry into an irreducible region we may expose new natural loops. */ if (! loops_state_satisfies_p (LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS) || e->dest->flags & BB_IRREDUCIBLE_LOOP) loops_state_set (LOOPS_NEED_FIXUP); } "fixes" this particular regression. But of course as soon as the reducible sub-CFG were removed in other ways (redirecting the entry and removing the exit edge) we'd be back at the very same issue. So I think we can't rely on those flags given the odd sub-CFG marking. But in fact what we could do is instead of static inline void checking_verify_loop_structure (void) { if (flag_checking) verify_loop_structure (); } do static inline void checking_verify_loop_structure (void) { loops_state_clear (LOOPS_NEED_FIXUP); if (flag_checking) verify_loop_structure (); } because that's essentially what those checking_verify_loop_structure will assert (and it'll be useful then to avoid excessive fixups as well).