+2018-03-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/84875
+ * dce.c (delete_unmarked_insns): Don't remove frame related noop moves
+ holding REG_CFA_RESTORE notes, instead turn them into a USE.
+
2018-03-20 Peter Bergner <bergner@vnet.ibm.com>
PR target/83789
FOR_BB_INSNS_REVERSE_SAFE (bb, insn, next)
if (NONDEBUG_INSN_P (insn))
{
+ rtx turn_into_use = NULL_RTX;
+
/* Always delete no-op moves. */
if (noop_move_p (insn))
- ;
+ {
+ if (RTX_FRAME_RELATED_P (insn))
+ turn_into_use
+ = find_reg_note (insn, REG_CFA_RESTORE, NULL);
+ if (turn_into_use && REG_P (XEXP (turn_into_use, 0)))
+ turn_into_use = XEXP (turn_into_use, 0);
+ else
+ turn_into_use = NULL_RTX;
+ }
/* Otherwise rely only on the DCE algorithm. */
else if (marked_insn_p (insn))
if (CALL_P (insn))
must_clean = true;
- /* Now delete the insn. */
- delete_insn_and_edges (insn);
+ if (turn_into_use)
+ {
+ /* Don't remove frame related noop moves if they cary
+ REG_CFA_RESTORE note, while we don't need to emit any code,
+ we need it to emit the CFI restore note. */
+ PATTERN (insn)
+ = gen_rtx_USE (GET_MODE (turn_into_use), turn_into_use);
+ INSN_CODE (insn) = -1;
+ df_insn_rescan (insn);
+ }
+ else
+ /* Now delete the insn. */
+ delete_insn_and_edges (insn);
}
/* Deleted a pure or const call. */
+2018-03-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/84875
+ * gcc.dg/pr84875.c: New test.
+
2018-03-20 Marek Polacek <polacek@redhat.com>
PR c++/84978, ICE with NRVO.