https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103860
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- In the: while (!vec.is_empty () && pro != entry) { while (pro != entry && !can_get_prologue (pro, prologue_clobbered)) { pro = get_immediate_dominator (CDI_DOMINATORS, pro); if (bitmap_set_bit (bb_with, pro->index)) vec.quick_push (pro); } basic_block bb = vec.pop (); if (!can_dup_for_shrink_wrapping (bb, pro, max_grow_size)) while (!dominated_by_p (CDI_DOMINATORS, bb, pro)) { gcc_assert (pro != entry); pro = get_immediate_dominator (CDI_DOMINATORS, pro); if (bitmap_set_bit (bb_with, pro->index)) vec.quick_push (pro); } FOR_EACH_EDGE (e, ei, bb->succs) if (e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun) && bitmap_set_bit (bb_with, e->dest->index)) vec.quick_push (e->dest); } loop, initially we try as pro bb 7 for which can_get_prologue (pro, prologue_clobbered) is true. We iterate for a while, until bb_with is 3, 4, 5, 6, 7, 8, pro still 7, and we pop bb 6, for which can_dup_for_shrink_wrapping is false. vec at this point is empty. As bb 6 isn't dominated by pro 7, we change pro to the immediate dominator of bb 7 which is bb 5, and as it already is in bb_with bitmap, we don't push anything. bb 6 also has no successors (it traps at the end), so we don't push there anything either. And because vec.is_empty () is true, the outer loop doesn't iterate any longer and so nothing checks if can_get_prologue (pro, prologue_clobbered) (which is false for bb 5).