From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2975 invoked by alias); 20 Dec 2013 22:40:13 -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 2915 invoked by uid 48); 20 Dec 2013 22:40:09 -0000 From: "vmakarov at gcc dot gnu.org" 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 22:40: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: vmakarov at gcc dot gnu.org 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: 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/msg01970.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56069 --- Comment #6 from Vladimir Makarov --- (In reply to Jeffrey A. Law from comment #5) > Maybe I'm missing something here. We have this immediately prior to IRA: > > 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? Preferred/alternative class is misleading here. It is not used anywhere in IRA/LRA for allocation decision (but may be it is used by reload -- i don't remember). It is only used as a temporary result for allocno class calculation. Hard reg preferences and copies are further in the dump. They looks as following cp0:a2(r88)<->a3(r86)@1000:constraint cp1:a0(r87)<->a1(r89)@1000:constraint cp2:a0(r87)<->a2(r88)@1000:constraint pref0:a0(r87)<-hr0@1500 pref1:a3(r86)<-hr5@1500 This problem is well known me. Jakub filled analogous PR. I am working on it. The reason of the problem are copies created for commutative ops insns. Two copies give different signals for hard reg preferences through the propagation mechanism. It is easy to make a test for this problem because the test should be small and involve arguments and result on small number of insns. Therefore we have a few such PRs. In bigger function, the probability of the problem occurrence is quite small.