public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "chaoyingfu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/54369] New: Delayed-branch pass in reorg.c removes too many instructions Date: Fri, 24 Aug 2012 18:17:00 -0000 [thread overview] Message-ID: <bug-54369-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54369 Bug #: 54369 Summary: Delayed-branch pass in reorg.c removes too many instructions Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: chaoyingfu@gcc.gnu.org Created attachment 28079 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28079 A simple test for an issue in reorg.c Please check this example when using GCC 4.6 for mips-linux-gnu. (I think the issue is in GCC 4.7 and later as well. But due to the basic block ordering, I cannot reproduce this issue.) Ex: # /gcc46branch/build-mips/gcc/cc1plus -quiet Bug.i -o Bug.s -mips32r2 -O2 # cat Bug.s _Z3bugP9ValueRTRK: .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0 .mask 0x00000000,0 .fmask 0x00000000,0 .set noreorder .set nomacro lw $2,0($4) <--------- lw $2,0($2) <--------- (NO RETURN IN THIS FUNCTION.) .set macro .set reorder .end _Z3bugP9ValueRTRK .cfi_endproc $LFE13: .size _Z3bugP9ValueRTRK, .-_Z3bugP9ValueRTRK .ident "GCC: (GNU) 4.6.4 20120823 (prerelease) [gcc-4_6-branch revision 190613]" The delayed-branch pass in reorg.c is too aggressive, such that a return instruction and others are removed. From debugging code in reorg.c: delete_jump() -> delete_computation() -> delete_related_insn(), I think we should not use delete_related_insn() that removes branches and all the following instructions. A simple fix may be just using delete_insn() in delete_computation(). Ex: # svn diff reorg.c Index: reorg.c =================================================================== --- reorg.c (revision 190636) +++ reorg.c (working copy) @@ -3298,7 +3298,7 @@ delete_prior_computation (note, insn); } - delete_related_insns (insn); + delete_insn (insn); } /* If all INSN does is set the pc, delete it, Ex: (Bug.s after this fix.) # cat Bug.s _Z3bugP9ValueRTRK: .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0 .mask 0x00000000,0 .fmask 0x00000000,0 .set noreorder .set nomacro lw $2,0($4) lw $2,0($2) $L4: j $31 <------------- OK srl $2,$2,8 <------------- OK .set macro .set reorder .end _Z3bugP9ValueRTRK .cfi_endproc $LFE13: .size _Z3bugP9ValueRTRK, .-_Z3bugP9ValueRTRK .ident "GCC: (GNU) 4.6.4 20120823 (prerelease) [gcc-4_6-branch revision 190613]" Thanks!
next reply other threads:[~2012-08-24 18:17 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-08-24 18:17 chaoyingfu at gcc dot gnu.org [this message] 2012-08-29 22:43 ` [Bug rtl-optimization/54369] " ebotcazou at gcc dot gnu.org 2012-08-31 0:31 ` sje at gcc dot gnu.org 2012-08-31 0:39 ` chaoyingfu at gcc dot gnu.org 2012-08-31 14:21 ` ebotcazou at gcc dot gnu.org 2012-08-31 18:17 ` sje at gcc dot gnu.org 2012-08-31 18:56 ` ebotcazou at gcc dot gnu.org 2012-09-01 8:17 ` rdsandiford at googlemail dot com 2012-09-01 9:22 ` ebotcazou at gcc dot gnu.org 2012-09-01 9:42 ` rdsandiford at googlemail dot com 2012-09-01 15:13 ` [Bug rtl-optimization/54369] delayed-branch pass " ebotcazou at gcc dot gnu.org 2012-09-02 10:37 ` ebotcazou at gcc dot gnu.org 2012-09-02 10:38 ` ebotcazou at gcc dot gnu.org 2012-09-02 10:39 ` ebotcazou at gcc dot gnu.org 2012-09-02 10:39 ` ebotcazou at gcc dot gnu.org 2012-09-02 10:39 ` ebotcazou at gcc dot gnu.org 2012-09-02 10:48 ` ebotcazou at gcc dot gnu.org 2014-02-16 10:00 ` jackie.rosen at hushmail dot com
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-54369-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).