From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19123 invoked by alias); 23 Apr 2013 15:34:44 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19068 invoked by uid 48); 23 Apr 2013 15:34:40 -0000 From: "vmakarov at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/57046] [4.8/4.9 Regression] wrong code generated by gcc 4.8.0 on i686 Date: Tue, 23 Apr 2013 15:34:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: vmakarov at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.1 X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg01972.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57046 Vladimir Makarov changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vmakarov at redhat dot com --- Comment #5 from Vladimir Makarov 2013-04-23 15:34:40 UTC --- (In reply to comment #4) > We have after the get_value call: > (insn 73 30 32 6 (set (reg:SI 76 [ D.1441 ]) > (reg:SI 0 ax)) pr57046.c:42 85 {*movsi_internal} > (expr_list:REG_DEAD (reg:SI 0 ax) > (nil))) > (insn 32 73 33 6 (parallel [ > (set (reg:SI 73 [ D.1443 ]) > (ashift:SI (subreg:SI (reg:DI 60 [ D.1441 ]) 0) > (const_int 2 [0x2]))) > (clobber (reg:CC 17 flags)) > ]) 502 {*ashlsi3_1} > (expr_list:REG_DEAD (reg:DI 60 [ D.1441 ]) > (expr_list:REG_UNUSED (reg:CC 17 flags) > (nil)))) > > and IRA decides to put pseudo 76 into %ebx and pseudo 60 into %ecx. Either it > is an IRA bug, or IRA takes into account that we only really need the low > 32-bits of pseudo 60 at that point. In any case, reload loads SImode %ecx from > the stack and uses it in the shift, while LRA loads full DImode %ecx (i.e. %ecx > and %ebx) from the stack, then uses just the low bits from that (i.e. %ecx) in > the shift. So the LRA generated code clobbers the value in %ebx, and get_value > call is even later on DCEd because of it. It seems like a discrepancy in IRA which allocates in terms of subregisters and LRA splitting (including call save/restore as in this case) in terms of pseudos. I guess fixing this might take about week.