From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10296 invoked by alias); 9 Sep 2014 06:07:11 -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 10262 invoked by uid 48); 9 Sep 2014 06:07:05 -0000 From: "zhenqiang.chen at arm dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/63210] ira does not select the best register compared with gcc 4.8 for ARM THUMB1 Date: Tue, 09 Sep 2014 06:07: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: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zhenqiang.chen at arm dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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: 2014-09/txt/msg01297.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63210 --- Comment #1 from Zhenqiang Chen --- Here is a workaround patch to show the point. diff --git a/gcc/ira-color.c b/gcc/ira-color.c index e2ea359..1573fb5 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -1709,6 +1709,8 @@ assign_hard_reg (ira_allocno_t a, bool retry_p) { ira_allocno_t conflict_a = OBJECT_ALLOCNO (conflict_obj); enum reg_class conflict_aclass; + HARD_REG_SET prof_regs; + prof_regs = ALLOCNO_COLOR_DATA (conflict_a)->profitable_hard_regs; /* Reload can give another class so we need to check all allocnos. */ @@ -1780,7 +1782,7 @@ assign_hard_reg (ira_allocno_t a, bool retry_p) hard_regno = ira_class_hard_regs[aclass][j]; ira_assert (hard_regno >= 0); k = ira_class_hard_reg_index[conflict_aclass][hard_regno]; - if (k < 0) + if (k < 0 || !TEST_HARD_REG_BIT (prof_regs, hard_regno)) continue; full_costs[j] -= conflict_costs[k]; } For this case, "r0" is not available for r115. The conflict for r110 on "r0" maybe meaningless.