https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67778
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bernds at gcc dot gnu.org, | |segher at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Seems like shrink-wrapping bug. On the #c2 -m32 -Os, we have one bb that needs prologue (the dominator of the exit block with the printf call, bb10). Infinite loop in BB 6. Infinite loop in BB 6. starting the processing of deferred insns ending the processing of deferred insns df_analyze called Attempting shrink-wrapping optimization. Block 10 needs the prologue. After wrapping required blocks, PRO is now 10 Avoiding non-duplicatable blocks, PRO is now 10 Bumping back to anticipatable blocks, PRO is now 9 Performing shrink-wrapping. but, bb9 is part of an irreducible loop, and by moving the prologue into the bb9, we end up with the prologue in the middle of a loop, which dwarf2cfi is obviously strongly unhappy about. So, the basic_block last_ok = pro; while (pro != entry) { basic_block pre = get_immediate_dominator (CDI_DOMINATORS, pro); if (!dominated_by_p (CDI_POST_DOMINATORS, pre, pro)) break; pro = pre; if (can_get_prologue (pro, prologue_clobbered)) last_ok = pro; } pro = last_ok; conditions are not sufficient, shall we also test whether pre is not inside of some loop (loops are freed at this point though)? Shall it be in this loop, or in can_get_prologue?