Richard, [now cc-ing gcc-patches]
this patch fixes PR50283 in a target-independent way. it asserts on frame-related insns in the delay slot of insns that can throw, and prevents the assert by testing for the same condition in eligible_for_{delay,annul_true,annul_false}. build and reg-tested on mips64el. I don't know of any tests currently failing on this, so I think it's not appropriate for stage4. OK for stage1 ? Thanks, - Tom 2012-01-27 Andrew Pinski <apin...@cavium.com> Tom de Vries <t...@codesourcery.com> * dwarf2cfi.c (scan_trace): Add assert that frame-related insns should not occur in delay-slots of insns that can throw. * genattrtab.c (write_eligible_delay): Prevent frame-related insns from occurring in delay-slots of insns that can throw.
Index: gcc/genattrtab.c =================================================================== --- gcc/genattrtab.c (revision 183557) +++ gcc/genattrtab.c (working copy) @@ -4280,6 +4280,12 @@ write_eligible_delay (const char *kind) printf (" if (!INSN_P (candidate_insn))\n"); printf (" return 0;\n"); printf ("\n"); + /* Frame-related instructions should not be put into delay slots of + instructions that can throw. */ + printf (" if (insn_could_throw_p (delay_insn)\n"); + printf (" && RTX_FRAME_RELATED_P (candidate_insn))\n"); + printf (" return 0;\n"); + printf ("\n"); /* If more than one delay type, find out which type the delay insn is. */ Index: gcc/dwarf2cfi.c =================================================================== --- gcc/dwarf2cfi.c (revision 183557) +++ gcc/dwarf2cfi.c (working copy) @@ -2474,6 +2474,8 @@ scan_trace (dw_trace_info *trace) for (i = 1; i < n; ++i) { elt = XVECEXP (pat, 0, i); + gcc_assert (!(insn_could_throw_p (control) + && RTX_FRAME_RELATED_P (elt))); scan_insn_after (elt); }