public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kkojima at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/49686] New: [4.7 Regression] CFI notes are missed for delayed slot Date: Sat, 09 Jul 2011 06:03:00 -0000 [thread overview] Message-ID: <bug-49686-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49686 Summary: [4.7 Regression] CFI notes are missed for delayed slot Product: gcc Version: unknown Status: UNCONFIRMED Keywords: EH Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: kkojima@gcc.gnu.org CC: rth@gcc.gnu.org Target: sh4-unknown-linux-gnu Many EH tests fail on SH after the recent dwarf2 clean up. These failures went away with -fno-delayed-branch. A tiny testcase is int foo (int a) { if (a) bar (); return 1; } and with -O1 -fexceptions -fnon-call-exceptions, its assember output of the new compiler starts like foo: .LFB0: tst r4,r4 bt/s .L2 sts.l pr,@-r15 while the old compiler outputs CFI for the last frame related insn sts.l pr,@-r15 in the delayed slot: foo: .LFB0: tst r4,r4 .LCFI0: bt/s .L2 sts.l pr,@-r15 It seems that dwarf2out_frame_debug emits CFI notes at the middle of the elements of SEQUENCE and they were lost. The patch below works for me. --- ORIG/trunk/gcc/dwarf2cfi.c 2011-07-09 14:42:50.000000000 +0900 +++ trunk/gcc/dwarf2cfi.c 2011-07-09 14:46:18.000000000 +0900 @@ -2170,11 +2170,10 @@ dwarf2out_frame_debug_expr (rtx expr) sets SP or FP (adjusting how we calculate the frame address) or saves a register to the stack. If INSN is NULL_RTX, initialize our state. - If AFTER_P is false, we're being called before the insn is emitted, - otherwise after. Call instructions get invoked twice. */ + Notes are inserted at WHERE. Call instructions get invoked twice. */ static void -dwarf2out_frame_debug (rtx insn, bool after_p) +dwarf2out_frame_debug (rtx insn, rtx where) { rtx note, n; bool handled_one = false; @@ -2183,13 +2182,13 @@ dwarf2out_frame_debug (rtx insn, bool af /* Remember where we are to insert notes. Do not separate tablejump insns from their ADDR_DIFF_VEC. Putting the note after the VEC should be ok. */ - if (after_p) + if (insn == where) { if (!tablejump_p (insn, NULL, &cfi_insn)) - cfi_insn = insn; + cfi_insn = where; } else - cfi_insn = PREV_INSN (insn); + cfi_insn = where; if (!NONJUMP_INSN_P (insn) || clobbers_queued_reg_save (insn)) dwarf2out_flush_queued_reg_saves (); @@ -2200,7 +2199,7 @@ dwarf2out_frame_debug (rtx insn, bool af matter if the stack pointer is not the CFA register anymore but is still used to save registers. */ if (!ACCUMULATE_OUTGOING_ARGS) - dwarf2out_notice_stack_adjust (insn, after_p); + dwarf2out_notice_stack_adjust (insn, (insn == where)); cfi_insn = NULL; return; } @@ -2434,7 +2433,7 @@ create_cfi_notes (void) if (BARRIER_P (insn)) { - dwarf2out_frame_debug (insn, false); + dwarf2out_frame_debug (insn, PREV_INSN (insn)); continue; } @@ -2469,7 +2468,7 @@ create_cfi_notes (void) pat = PATTERN (insn); if (asm_noperands (pat) >= 0) { - dwarf2out_frame_debug (insn, false); + dwarf2out_frame_debug (insn, PREV_INSN (insn)); continue; } @@ -2477,14 +2476,14 @@ create_cfi_notes (void) { int i, n = XVECLEN (pat, 0); for (i = 1; i < n; ++i) - dwarf2out_frame_debug (XVECEXP (pat, 0, i), false); + dwarf2out_frame_debug (XVECEXP (pat, 0, i), PREV_INSN (insn)); } if (CALL_P (insn) || find_reg_note (insn, REG_CFA_FLUSH_QUEUE, NULL)) - dwarf2out_frame_debug (insn, false); + dwarf2out_frame_debug (insn, PREV_INSN (insn)); - dwarf2out_frame_debug (insn, true); + dwarf2out_frame_debug (insn, insn); } }
next reply other threads:[~2011-07-09 6:03 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-07-09 6:03 kkojima at gcc dot gnu.org [this message] 2011-07-09 15:19 ` [Bug rtl-optimization/49686] " hp at gcc dot gnu.org 2011-07-09 16:14 ` rth at gcc dot gnu.org 2011-07-09 19:58 ` rth at gcc dot gnu.org 2011-07-09 20:59 ` rth at gcc dot gnu.org 2011-07-09 21:14 ` kkojima at gcc dot gnu.org 2011-07-11 9:28 ` rguenth at gcc dot gnu.org 2011-08-04 12:18 ` kkojima at gcc dot gnu.org 2011-08-04 13:31 ` hp at gcc dot gnu.org 2011-08-04 13:57 ` kkojima at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-49686-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).