https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82355
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 #2 from Richard Biener <rguenth at gcc dot gnu.org> --- I somehow knew you'd come up with infinite loop testcases ;) This is because of static inline bool bb_in_region (const_basic_block bb, const_basic_block entry, const_basic_block exit) { return dominated_by_p (CDI_DOMINATORS, bb, entry) && !(dominated_by_p (CDI_DOMINATORS, bb, exit) && !dominated_by_p (CDI_DOMINATORS, entry, exit)); } and when the exit of the SESE region is the latch edge then indeed the loop doesn't belong to the region. An infinite loop doesn't have an exit after all ... I'm not quite sure we shouldn't make it have an exit by means of a fake edge but that would probably fix the ICE. The reason for the strange region is merge_sese being overly "clever". I have a patch in testing that avoids asking outermost_loop_in_sese for this case.