From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31008 invoked by alias); 8 Jul 2015 11:48:25 -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 30542 invoked by uid 48); 8 Jul 2015 11:48:21 -0000 From: "matz at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/66782] [5/6 Regression] Unable to run 64-bit wine after MS->SYSV register changes Date: Wed, 08 Jul 2015 11:48: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-Version: 6.0 X-Bugzilla-Keywords: ra X-Bugzilla-Severity: normal X-Bugzilla-Who: matz at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg00642.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66782 Michael Matz changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matz at gcc dot gnu.org --- Comment #9 from Michael Matz --- FWIW, it's the inheritance code that breaks this. From the reload (aka lra) dump: Creating newreg=380 from oldreg=89, assigning class GENERAL_REGS to inheritance r380 Original reg change 89->380 (bb25): 593: r342:DI=r380:DI Add inheritance<-original before: 633: r380:DI=r89:DI Inheritance reuse change 89->380 (bb25): 594: r343:DI=r380:DI r89 is the original register that is live over the call, and which didn't get a hardreg. insn 593 and 633 are an optional reload for an insn (212) _before_ the call, insn 594 is a (inheritance) reload insn _after_ the call (for insn 222), ala this: (insn 633 591 593 25 (set (reg:DI 4 si [orig:89 D.1995 ] [89]) (mem/c:DI (plus:DI (reg/f:DI 7 sp) (const_int 24 [0x18])) [11 %sfp+-216 S8 A64])) wine.c:95 85 {*movdi_internal} (nil)) (insn 593 633 212 25 (set (reg:DI 1 dx [orig:89 D.1995 ] [89]) (reg:DI 4 si [orig:89 D.1995 ] [89])) wine.c:95 85 {*movdi_internal} (nil)) (insn 212 593 592 25 (parallel [ (set (reg:DI 5 di [orig:224 D.1995 ] [224]) (minus:DI (reg:DI 5 di [orig:224 D.1995 ] [224]) (reg:DI 1 dx [orig:89 D.1995 ] [89]))) (clobber (reg:CC 17 flags)) ]) wine.c:95 259 {*subdi_1} (expr_list:REG_EQUAL (minus:DI (mem/f/c:DI (plus:DI (reg/f:DI 20 frame) (const_int -128 [0xffffffffffffff80])) [2 arch.ptr+0 S8 A128 ]) (reg:DI 89 [ D.1995 ])) (nil))) ... more insn, amongst them insn 217, the call insn clobbering reg 4 aka SI ... (insn 594 221 632 25 (set (reg:DI 1 dx [orig:230 D.1995 ] [230]) (reg:DI 4 si [orig:89 D.1995 ] [89])) wine.c:96 85 {*movdi_internal} (nil)) (insn 632 594 222 25 (set (reg/f:DI 2 cx [orig:121 D.1996 ] [121]) (mem/c:DI (plus:DI (reg/f:DI 7 sp) (const_int 40 [0x28])) [11 %sfp+-200 S8 A64])) wine.c:96 85 {*movdi_internal} (nil)) (insn 222 632 596 25 (parallel [ (set (reg:DI 1 dx [orig:230 D.1995 ] [230]) (minus:DI (reg:DI 1 dx [orig:230 D.1995 ] [230]) (reg/f:DI 2 cx [orig:121 D.1996 ] [121]))) (clobber (reg:CC 17 flags)) ]) wine.c:96 259 {*subdi_1} (nil)) So, insn 594 reuses the inheritance register 380 from before the call (setup in insn 633), so r380 is live over the call. But LRA happily does this to this reload inheritance reg: Assigning to 380 (cl=GENERAL_REGS, orig=89, freq=33, tfirst=340, tfreq=66)... Assign 4 to inheritance r380 (freq=33) Voila, hardreg 4 is assigned to r380, even though it lives over a clobber of it. I don't see any code in inherit_reload_reg or its caller inherit_in_ebb that would look at CALL_INSN_FUNCTION_USAGE on any intervening insns, between the inheritance setup and any of the next usage insns.