Message ID | e8a1ae7870bbbd8d70d55483b24e014d0c4713fe.1474616087.git.segher@kernel.crashing.org |
---|---|
State | New |
Headers | show |
On 09/23/2016 02:21 AM, Segher Boessenkool wrote: > 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 after this). > This happens with gcc.dg/torture/pr53168.c, for example. > > > 2016-09-23 Segher Boessenkool <segher@kernel.crashing.org> > > * dce.c (delete_unmarked_insns): Don't delete instructions with > a REG_CFA_RESTORE note. OK and can go in now IMHO. jeff
diff --git a/gcc/dce.c b/gcc/dce.c index ea3fb00..d510287 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));