From patchwork Tue Aug 23 23:07:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 111201 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 CCDA9B6F18 for ; Wed, 24 Aug 2011 09:07:27 +1000 (EST) Received: (qmail 20653 invoked by alias); 23 Aug 2011 23:07:25 -0000 Received: (qmail 20644 invoked by uid 22791); 23 Aug 2011 23:07:24 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS 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; Tue, 23 Aug 2011 23:07:05 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7NN75HJ005861 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 23 Aug 2011 19:07:05 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7NN75Ta013923 for ; Tue, 23 Aug 2011 19:07:05 -0400 Received: from localhost.localdomain (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p7NN73px004297 for ; Tue, 23 Aug 2011 19:07:04 -0400 Message-ID: <4E54329B.5040701@redhat.com> Date: Tue, 23 Aug 2011 19:07:07 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Thunderbird/3.1.11 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: patch to solve recent SPEC2000 degradation 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 Starting Aug 20, there is about 1.5% degradation on x86 SPEC2000, please see http://vmakarov.fedorapeople.org/spec/. The reason for this was my patch http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01623.html for solving code performance degradation on MIPS. Instead of using explicitly necessary number of registers, I used contains_reg_of_mode which also checks the number of necessary registers but also it checks that the register class can hold value of given mode. This resulted in different register pressure classes (before the patch, they were GENERAL_REGS and FLOAT_REGS for x86. They became only INT_FLOAT_REGS) because it became not costly to hold integer mode value in FLOAT_REGS. The new register pressure class in own turn resulted in low register pressure and one region allocation in most cases instead of multiple region RA. As a consequence, we got a big degradation on Intel 32 bit targets. I did check code differences and did not find the code difference on my Aug 19 patch in 32-bit and 64-bit mode. My mistake was in that I used a very small tests for which one region allocation was used with and without the patch. Sorry for any inconvenience. It is always hard to fix performance bugs in IRA because it is very machine-dependent pass which is always used in GCC. The following patch should be the right patch. It does not result in code difference on x86 and x86-64 SPEC2000 any more. It still solves the mips code performance problem and was successfully bootstrapped on x86-64. Committed as rev. 178019. 2011-08-23 Vladimir Makarov * ira.c (ira_init_register_move_cost): Check small subclasses through ira_reg_class_max_nregs and ira_available_class_regs. Index: ira.c =================================================================== --- ira.c (revision 177968) +++ ira.c (working copy) @@ -1503,7 +1503,7 @@ ira_init_register_move_cost (enum machin { /* Some subclasses are to small to have enough registers to hold a value of MODE. Just ignore them. */ - if (! contains_reg_of_mode[cl1][mode]) + if (ira_reg_class_max_nregs[cl1][mode] > ira_available_class_regs[cl1]) continue; COPY_HARD_REG_SET (temp_hard_regset, reg_class_contents[cl1]); AND_COMPL_HARD_REG_SET (temp_hard_regset, no_unit_alloc_regs);