From patchwork Wed Mar 30 01:28:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 88872 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 68EE1B6F44 for ; Wed, 30 Mar 2011 12:24:29 +1100 (EST) Received: (qmail 28202 invoked by alias); 30 Mar 2011 01:24:27 -0000 Received: (qmail 28194 invoked by uid 22791); 30 Mar 2011 01:24:26 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 Mar 2011 01:24:20 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2U1OJhs002735 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 29 Mar 2011 21:24:19 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2U1OIWS000748 for ; Tue, 29 Mar 2011 21:24:19 -0400 Received: from 1005.home (ovpn-113-42.phx2.redhat.com [10.3.113.42]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p2U1OHXY016506 for ; Tue, 29 Mar 2011 21:24:18 -0400 Message-ID: <4D92873D.6020203@redhat.com> Date: Tue, 29 Mar 2011 21:28:29 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 MIME-Version: 1.0 To: gcc-patches Subject: RFA: patch to solve IRA PR48336, PR48342, PR48345 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The following patch is to solve PR48336, PR48342, PR48345. The profitable hard regs exclude hard regs which are prohibited for the corresponding allocno mode. It is true for primary allocation and it is important for better colorability criteria. Function assign_hard_reg is also based on this assumption. Unfortunately, it is not true for secondary allocation (after IRA IR flattening or during reload). The following patch solves this problem. The patch should be very safe but I am still testing it on x86/x86-64 bootstrap. Is it ok to commit the patch after successful bootsrapping? 2011-03-29 Vladimir Makarov PR target/48336 PR middle-end/4834 PR rtl-optimization/48345 * ira-color.c (setup_conflict_profitable_regs): Exclude prohibited hard regs for given mode from profitable regs when doing secondary allocation. Index: ira-color.c =================================================================== --- ira-color.c (revision 171699) +++ ira-color.c (working copy) @@ -1447,7 +1447,9 @@ update_conflict_hard_regno_costs (int *c } /* Set up conflicting and profitable regs (through CONFLICT_REGS and - PROFITABLE_REGS) for each object of allocno A. */ + PROFITABLE_REGS) for each object of allocno A. Remember that the + profitable regs exclude hard regs which can not hold value of mode + of allocno A. */ static inline void setup_conflict_profitable_regs (ira_allocno_t a, bool retry_p, HARD_REG_SET *conflict_regs, @@ -1463,8 +1465,13 @@ setup_conflict_profitable_regs (ira_allo COPY_HARD_REG_SET (conflict_regs[i], OBJECT_TOTAL_CONFLICT_HARD_REGS (obj)); if (retry_p) - COPY_HARD_REG_SET (profitable_regs[i], - reg_class_contents[ALLOCNO_CLASS (a)]); + { + COPY_HARD_REG_SET (profitable_regs[i], + reg_class_contents[ALLOCNO_CLASS (a)]); + AND_COMPL_HARD_REG_SET (profitable_regs[i], + ira_prohibited_class_mode_regs + [ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)]); + } else COPY_HARD_REG_SET (profitable_regs[i], OBJECT_COLOR_DATA (obj)->profitable_hard_regs);