From: Segher Boessenkool Date: Wed, 12 Oct 2016 15:21:38 +0000 (+0200) Subject: dce: Don't dead-code delete separately wrapped restores X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aab648a9fcf8c222ab43612915d11b093e11849d;p=gcc.git dce: Don't dead-code delete separately wrapped restores If there is a separately wrapped register restore on some path that is dead (say, control goes into an endless loop after it), then we cannot delete that restore because that would confuse the DWARF CFI (if there is another path joining). This happens with gcc.dg/torture/pr53168.c, for example. * dce.c (delete_unmarked_insns): Don't delete instructions with a REG_CFA_RESTORE note. From-SVN: r241060 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 323bf353a1c..77935447474 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-10-12 Segher Boessenkool + + * dce.c (delete_unmarked_insns): Don't delete instructions with + a REG_CFA_RESTORE note. + 2016-10-12 Segher Boessenkool * common.opt (-fshrink-wrap-separate): New flag. diff --git a/gcc/dce.c b/gcc/dce.c index ea3fb00d433..d5102873f60 100644 --- a/gcc/dce.c +++ b/gcc/dce.c @@ -587,6 +587,15 @@ delete_unmarked_insns (void) if (!dbg_cnt (dce)) continue; + if (crtl->shrink_wrapped_separate + && find_reg_note (insn, REG_CFA_RESTORE, NULL)) + { + if (dump_file) + fprintf (dump_file, "DCE: NOT deleting insn %d, it's a " + "callee-save restore\n", INSN_UID (insn)); + continue; + } + if (dump_file) fprintf (dump_file, "DCE: Deleting insn %d\n", INSN_UID (insn));