From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60705 invoked by alias); 24 Sep 2015 20:41:31 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 60696 invoked by uid 89); 24 Sep 2015 20:41:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 24 Sep 2015 20:41:30 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id CE88FC0B1B2F for ; Thu, 24 Sep 2015 20:41:28 +0000 (UTC) Received: from topor.usersys.redhat.com (unused-10-15-17-214.yyz.redhat.com [10.15.17.214]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8OKfShu012344 for ; Thu, 24 Sep 2015 16:41:28 -0400 Message-ID: <56045FF8.6070106@redhat.com> Date: Thu, 24 Sep 2015 22:28:00 -0000 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: gcc-patches Subject: patch for PR61578 Content-Type: multipart/mixed; boundary="------------000107050705030400000005" X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg01899.txt.bz2 This is a multi-part message in MIME format. --------------000107050705030400000005 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 646 The following patch solves the 2nd case of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61578 I did a lot of benchmarking of different heuristics in hard reg cost propagation in IRA. This is the best what I found. The patch improves stably code size of SPEC2000 and its score although it is not that significant. The patch was tested and bootstrapped on x86-64. Committed as rev. 228097. 2015-09-24 Vladimir Makarov PR target/61578 * ira-color.c (update_allocno_cost): Add parameter. (update_costs_from_allocno): Decrease conflict cost. Pass the new parameter. --------------000107050705030400000005 Content-Type: text/x-patch; name="pr61578-2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr61578-2.patch" Content-length: 2473 Index: ira-color.c =================================================================== --- ira-color.c (revision 227495) +++ ira-color.c (working copy) @@ -1311,10 +1311,12 @@ get_next_update_cost (ira_allocno_t *all return true; } -/* Increase costs of HARD_REGNO by UPDATE_COST for ALLOCNO. Return - true if we really modified the cost. */ +/* Increase costs of HARD_REGNO by UPDATE_COST and conflict cost by + UPDATE_CONFLICT_COST for ALLOCNO. Return true if we really + modified the cost. */ static bool -update_allocno_cost (ira_allocno_t allocno, int hard_regno, int update_cost) +update_allocno_cost (ira_allocno_t allocno, int hard_regno, + int update_cost, int update_conflict_cost) { int i; enum reg_class aclass = ALLOCNO_CLASS (allocno); @@ -1330,7 +1332,7 @@ update_allocno_cost (ira_allocno_t alloc (&ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (allocno), aclass, 0, ALLOCNO_CONFLICT_HARD_REG_COSTS (allocno)); ALLOCNO_UPDATED_HARD_REG_COSTS (allocno)[i] += update_cost; - ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (allocno)[i] += update_cost; + ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (allocno)[i] += update_conflict_cost; return true; } @@ -1342,7 +1344,7 @@ static void update_costs_from_allocno (ira_allocno_t allocno, int hard_regno, int divisor, bool decr_p, bool record_p) { - int cost, update_cost; + int cost, update_cost, update_conflict_cost; machine_mode mode; enum reg_class rclass, aclass; ira_allocno_t another_allocno, from = NULL; @@ -1383,11 +1385,20 @@ update_costs_from_allocno (ira_allocno_t if (decr_p) cost = -cost; - update_cost = cp->freq * cost / divisor; + update_conflict_cost = update_cost = cp->freq * cost / divisor; + + if (ALLOCNO_COLOR_DATA (another_allocno) != NULL + && (ALLOCNO_COLOR_DATA (allocno)->first_thread_allocno + != ALLOCNO_COLOR_DATA (another_allocno)->first_thread_allocno)) + /* Decrease conflict cost of ANOTHER_ALLOCNO if it is not + in the same allocation thread. */ + update_conflict_cost /= COST_HOP_DIVISOR; + if (update_cost == 0) continue; - if (! update_allocno_cost (another_allocno, hard_regno, update_cost)) + if (! update_allocno_cost (another_allocno, hard_regno, + update_cost, update_conflict_cost)) continue; queue_update_cost (another_allocno, allocno, divisor * COST_HOP_DIVISOR); if (record_p && ALLOCNO_COLOR_DATA (another_allocno) != NULL) --------------000107050705030400000005--