From patchwork Mon Aug 8 23:19:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 109109 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 161A4B6F7F for ; Tue, 9 Aug 2011 09:20:16 +1000 (EST) Received: (qmail 2083 invoked by alias); 8 Aug 2011 23:20:14 -0000 Received: (qmail 2074 invoked by uid 22791); 8 Aug 2011 23:20:14 -0000 X-SWARE-Spam-Status: No, hits=-6.7 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; Mon, 08 Aug 2011 23:19:56 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p78NJuI5020312 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 8 Aug 2011 19:19:56 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p78NJt06005620 for ; Mon, 8 Aug 2011 19:19:56 -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 p78NJsUF027270 for ; Mon, 8 Aug 2011 19:19:55 -0400 Message-ID: <4E406F1F.8030508@redhat.com> Date: Mon, 08 Aug 2011 19:19:59 -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 fix PR49990 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 fixes PR49990. The problem is described on http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49936 Reg classes which can not change modes for some pseudo were excluded from the consideration. As I wrote recently, they should not. Instead the correct cost for changing mode (by moving through memory or other class register) should be taken into the account. I believe the cost is already calculated rightly for this case, fortunately. The patch was successfully bootstrapped on x86-64 and ppc64. Actually I did not find a difference in generated code on variety tests on x86/x86-64 and arm (that is what I tried). Committed as rev. 177575. 2011-08-08 Vladimir Makarov PR rtl-optimization/49990 * ira-costs.c (print_allocno_costs, print_pseudo_costs): Don't ignore classes which can not change mode. (find_costs_and_classes): Ditto. Index: ira-costs.c =================================================================== --- ira-costs.c (revision 177573) +++ ira-costs.c (working copy) @@ -1367,11 +1367,7 @@ print_allocno_costs (FILE *f) for (k = 0; k < cost_classes_ptr->num; k++) { rclass = cost_classes[k]; - if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)] -#ifdef CANNOT_CHANGE_MODE_CLASS - && ! invalid_mode_change_p (regno, (enum reg_class) rclass) -#endif - ) + if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)]) { fprintf (f, " %s:%d", reg_class_names[rclass], COSTS (costs, i)->cost[k]); @@ -1409,11 +1405,7 @@ print_pseudo_costs (FILE *f) for (k = 0; k < cost_classes_ptr->num; k++) { rclass = cost_classes[k]; - if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)] -#ifdef CANNOT_CHANGE_MODE_CLASS - && ! invalid_mode_change_p (regno, (enum reg_class) rclass) -#endif - ) + if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)]) fprintf (f, " %s:%d", reg_class_names[rclass], COSTS (costs, regno)->cost[k]); } @@ -1650,11 +1642,7 @@ find_costs_and_classes (FILE *dump_file) rclass = cost_classes[k]; /* Ignore classes that are too small or invalid for this operand. */ - if (! contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (i)] -#ifdef CANNOT_CHANGE_MODE_CLASS - || invalid_mode_change_p (i, (enum reg_class) rclass) -#endif - ) + if (! contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (i)]) continue; if (i_costs[k] < best_cost) { @@ -1725,11 +1713,7 @@ find_costs_and_classes (FILE *dump_file) continue; /* Ignore classes that are too small or invalid for this operand. */ - if (! contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (i)] -#ifdef CANNOT_CHANGE_MODE_CLASS - || invalid_mode_change_p (i, (enum reg_class) rclass) -#endif - ) + if (! contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (i)]) ; else if (total_a_costs[k] < best_cost) {