From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18961 invoked by alias); 20 Dec 2013 21:23:45 -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 18452 invoked by uid 48); 20 Dec 2013 21:23:10 -0000 From: "law at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/56069] [4.7/4.8/4.9 Regression] RA pessimization Date: Fri, 20 Dec 2013 21:23: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: 4.8.0 X-Bugzilla-Keywords: missed-optimization, ra X-Bugzilla-Severity: normal X-Bugzilla-Who: law at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.0 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: 2013-12/txt/msg01957.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56069 Jeffrey A. Law changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |law at redhat dot com --- Comment #5 from Jeffrey A. Law --- Maybe I'm missing something here. We have this immediately prior to IRA: (insn 2 4 3 2 (set (reg/v:DI 86 [ mem ]) (reg:DI 5 di [ mem ])) j.c:2 89 {*movdi_internal} (expr_list:REG_DEAD (reg:DI 5 di [ mem ]) (nil))) (note 3 2 6 2 NOTE_INSN_FUNCTION_BEG) (insn 6 3 7 2 (parallel [ (set (reg:DI 88 [ D.1760 ]) (lshiftrt:DI (reg/v:DI 86 [ mem ]) (const_int 3 [0x3]))) (clobber (reg:CC 17 flags)) ]) j.c:3 562 {*lshrdi3_1} (expr_list:REG_DEAD (reg/v:DI 86 [ mem ]) (expr_list:REG_UNUSED (reg:CC 17 flags) (nil)))) (insn 7 6 8 2 (set (reg:DI 89) (const_int 17592186044416 [0x100000000000])) j.c:3 89 {*movdi_internal} (nil)) (insn 8 7 13 2 (parallel [ (set (reg:DI 87 [ D.1760 ]) (ior:DI (reg:DI 88 [ D.1760 ]) (reg:DI 89))) (clobber (reg:CC 17 flags)) ]) j.c:3 421 {*iordi_1} (expr_list:REG_DEAD (reg:DI 89) (expr_list:REG_DEAD (reg:DI 88 [ D.1760 ]) (expr_list:REG_UNUSED (reg:CC 17 flags) (expr_list:REG_EQUAL (ior:DI (reg:DI 88 [ D.1760 ]) (const_int 17592186044416 [0x100000000000])) (nil)))))) (insn 13 8 16 2 (set (reg/i:DI 0 ax) (reg:DI 87 [ D.1760 ])) j.c:4 89 {*movdi_internal} (expr_list:REG_DEAD (reg:DI 87 [ D.1760 ]) (nil))) (insn 16 13 0 2 (use (reg/i:DI 0 ax)) j.c:4 -1 (nil)) ISTM that we want (reg 86) to prefer di and (reg 87) to prefer ax by way of the hard register copies. (reg 88) should then prefer di by way of insn 6. (reg 89) really doesn't need a preference and can go anywhere that doesn't conflict. So if we look at the IRA dump we have: Pass 1 for finding pseudo/allocno costs r89: preferred GENERAL_REGS, alternative NO_REGS, allocno GENERAL_REGS r88: preferred GENERAL_REGS, alternative NO_REGS, allocno GENERAL_REGS r87: preferred AREG, alternative GENERAL_REGS, allocno GENERAL_REGS r86: preferred DIREG, alternative GENERAL_REGS, allocno GENERAL_REGS Which I guess is OK. A bit surprised to not see r88 preferring DIreg at this point, but I guess copies implied by the 2 operand nature are handled later. ISTM that the copy implied by insn 6 should result in 88 somehow preferring DIreg. Then, ideally we'd see that while 89 can go anywhere it's best to match it with 87. Vlad, what am I missing here?