dwarf2out has code that starts scanning from NOTE_INSN_EPILOGUE_BEG
until it finds the return jump. When there is common code in several
blocks ending in a return, we might want to share this, and in that case
it would be possible to encounter a simplejump rather than a returnjump.
This should be safe, and the following patch allows it.
Bernd
* cfgcleanup.c (flow_find_head_matching_sequence): Ignore
epilogue notes.
* df-problems.c (can_move_insns_across): Don't stop at epilogue
notes.
* dwarf2out.c (dwarf2out_cfi_begin_epilogue): Also allow a
simplejump to end the block.
Index: gcc/cfgcleanup.c
===================================================================
--- gcc.orig/cfgcleanup.c
+++ gcc/cfgcleanup.c
@@ -1184,20 +1184,12 @@ flow_find_head_matching_sequence (basic_
while (true)
{
- /* Ignore notes, except NOTE_INSN_EPILOGUE_BEG. */
+ /* Ignore notes. */
while (!NONDEBUG_INSN_P (i1) && i1 != BB_END (bb1))
- {
- if (NOTE_P (i1) && NOTE_KIND (i1) == NOTE_INSN_EPILOGUE_BEG)
- break;
- i1 = NEXT_INSN (i1);
- }
+ i1 = NEXT_INSN (i1);
while (!NONDEBUG_INSN_P (i2) && i2 != BB_END (bb2))
- {
- if (NOTE_P (i2) && NOTE_KIND (i2) == NOTE_INSN_EPILOGUE_BEG)
- break;
- i2 = NEXT_INSN (i2);
- }
+ i2 = NEXT_INSN (i2);
if ((i1 == BB_END (bb1) && !NONDEBUG_INSN_P (i1))
|| (i2 == BB_END (bb2) && !NONDEBUG_INSN_P (i2)))
Index: gcc/df-problems.c
===================================================================
--- gcc.orig/df-problems.c
+++ gcc/df-problems.c
@@ -3953,8 +3953,6 @@ can_move_insns_across (rtx from, rtx to,
{
if (CALL_P (insn))
break;
- if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_EPILOGUE_BEG)
- break;
if (NONDEBUG_INSN_P (insn))
{
if (may_trap_or_fault_p (PATTERN (insn))
Index: gcc/dwarf2out.c
===================================================================
--- gcc.orig/dwarf2out.c
+++ gcc/dwarf2out.c
@@ -2939,10 +2939,10 @@ dwarf2out_frame_debug (rtx insn, bool af
dwarf2out_flush_queued_reg_saves ();
}
-/* Determine if we need to save and restore CFI information around this
- epilogue. If SIBCALL is true, then this is a sibcall epilogue. If
- we do need to save/restore, then emit the save now, and insert a
- NOTE_INSN_CFA_RESTORE_STATE at the appropriate place in the stream. */
+/* Determine if we need to save and restore CFI information around
+ this epilogue. If we do need to save/restore, then emit the save
+ now, and insert a NOTE_INSN_CFA_RESTORE_STATE at the appropriate
+ place in the stream. */
void
dwarf2out_cfi_begin_epilogue (rtx insn)
@@ -2957,8 +2957,10 @@ dwarf2out_cfi_begin_epilogue (rtx insn)
if (!INSN_P (i))
continue;
- /* Look for both regular and sibcalls to end the block. */
- if (returnjump_p (i))
+ /* Look for both regular and sibcalls to end the block. Various
+ optimization passes may cause us to jump to a common epilogue
+ tail, so we also accept simplejumps. */
+ if (returnjump_p (i) || simplejump_p (i))
break;
if (CALL_P (i) && SIBLING_CALL_P (i))
break;