@@ -800,6 +800,9 @@ dwarf2out_cfi_label (bool force)
/* True if remember_state should be emitted before following CFI directive. */
static bool emit_cfa_remember;
+/* True if any CFI directives were emitted at the current insn. */
+static bool any_cfis_emitted;
+
/* Add CFI to the current fde at the PC value indicated by LABEL if specified,
or to the CIE if LABEL is NULL. */
@@ -879,6 +882,7 @@ add_fde_cfi (const char *label, dw_cfi_r
output_cfi_directive (cfi);
list_head = &fde->dw_fde_cfi;
+ any_cfis_emitted = true;
}
/* ??? If this is a CFI for the CIE, we don't emit. This
assumes that the standard CIE contents that the assembler
@@ -916,6 +920,7 @@ add_fde_cfi (const char *label, dw_cfi_r
}
list_head = &fde->dw_fde_cfi;
+ any_cfis_emitted = true;
}
add_cfi (list_head, cfi);
@@ -2745,6 +2750,7 @@ dwarf2out_frame_debug (rtx insn, bool af
}
label = dwarf2out_cfi_label (false);
+ any_cfis_emitted = false;
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
switch (REG_NOTE_KIND (note))
@@ -2830,7 +2836,11 @@ dwarf2out_frame_debug (rtx insn, bool af
break;
}
if (handled_one)
- return;
+ {
+ if (any_cfis_emitted)
+ dwarf2out_flush_queued_reg_saves ();
+ return;
+ }
insn = PATTERN (insn);
found:
@@ -2839,7 +2849,7 @@ dwarf2out_frame_debug (rtx insn, bool af
/* Check again. A parallel can save and update the same register.
We could probably check just once, here, but this is safer than
removing the check above. */
- if (clobbers_queued_reg_save (insn))
+ if (any_cfis_emitted || clobbers_queued_reg_save (insn))
dwarf2out_flush_queued_reg_saves ();
}