From patchwork Fri Feb 27 22:03:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 444508 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 392E41400D5 for ; Sat, 28 Feb 2015 09:03:31 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=cYLvcOt2; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=MIHhMSD8h1RlG5baQHfdffaHisriAB14q/iWfwytMNVl2R oQfPBbk49DBkMn0LMWF2ydyp/VX8yDBacbWIJQm0ijhMkIUJ2dwNdJlfYl1m9Gss aO6QH9ZvVbkJlMSZ0rGg5fxflYsb44gj2QBJbGLY6mhk3qWL16G5Tt804PvBY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=+KLmqKSQCgAPPC1B2wZEZ4VU9BI=; b=cYLvcOt2RMmXyuBxzt9p ixuvAFTw/IBkrRLdQSJebZfHero9unfDE+S/Blu3kOBWvXhKodwwPR/+mBz7zHnT nmLU5dnj8ULa/YHbV0H+7XxioeXngGBGbE33GOQdPjBSz+je/I1/ybQ51KFJRH8q dGkJdsWJq7Z7H/PxENhuQLs= Received: (qmail 97846 invoked by alias); 27 Feb 2015 22:03:24 -0000 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 Received: (qmail 97833 invoked by uid 89); 27 Feb 2015 22:03:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham 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; Fri, 27 Feb 2015 22:03:16 +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 t1RM3FBw027144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 27 Feb 2015 17:03:15 -0500 Received: from Vladimirs-MacBook-Pro.local (vpn-60-20.rdu2.redhat.com [10.10.60.20]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1RM3EfO017572 for ; Fri, 27 Feb 2015 17:03:15 -0500 Message-ID: <54F0E9A2.4020407@redhat.com> Date: Fri, 27 Feb 2015 17:03:14 -0500 From: Vladimir Makarov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: one more patch for PR64317 X-IsSubscribed: yes The following patch improves inheritance for PR64317 testcase https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64317 I ran a lot SPEC2000 benchmarks to get better default parameter value for EBB_PROBABILITY_CUTOFF in LRA inheritance. The new default parameter value improves SPECInt2000 by 0.4% on x86-64 without changing SPECFP2000 rate. The code size changes are insignificant (0.002% increase for SPECInt and 0.01% decrease for SPECFP). The patch was bootstrapped and tested on x86-64. Committed as rev.221070. 2015-02-27 Vladimir Makarov PR target/64317 * params.def (PARAM_LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF): New. * params.h (LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF): New. * lra-constraints.c (EBB_PROBABILITY_CUTOFF): Use LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF. (lra_inheritance): Use '<' instead of '<=' for EBB_PROBABILITY_CUTOFF. * doc/invoke.texi (lra-inheritance-ebb-probability-cutoff): Document change. Index: params.def =================================================================== --- params.def (revision 220916) +++ params.def (working copy) @@ -836,6 +836,11 @@ DEFPARAM (PARAM_LRA_MAX_CONSIDERED_RELOA "The max number of reload pseudos which are considered during spilling a non-reload pseudo", 500, 0, 0) +DEFPARAM (PARAM_LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF, + "lra-inheritance-ebb-probability-cutoff", + "Minimal fall-through edge probability in percentage used to add BB to inheritance EEB in LRA", + 40, 0, 100) + /* Switch initialization conversion will refuse to create arrays that are bigger than this parameter times the number of switch branches. */ Index: params.h =================================================================== --- params.h (revision 220916) +++ params.h (working copy) @@ -202,6 +202,8 @@ extern void init_param_values (int *para PARAM_VALUE (PARAM_IRA_LOOP_RESERVED_REGS) #define LRA_MAX_CONSIDERED_RELOAD_PSEUDOS \ PARAM_VALUE (PARAM_LRA_MAX_CONSIDERED_RELOAD_PSEUDOS) +#define LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF \ + PARAM_VALUE (PARAM_LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF) #define SWITCH_CONVERSION_BRANCH_RATIO \ PARAM_VALUE (PARAM_SWITCH_CONVERSION_BRANCH_RATIO) #define LOOP_INVARIANT_MAX_BBS_IN_LOOP \ Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 220916) +++ lra-constraints.c (working copy) @@ -154,6 +154,7 @@ #include "df.h" #include "ira.h" #include "rtl-error.h" +#include "params.h" #include "lra-int.h" /* Value of LRA_CURR_RELOAD_NUM at the beginning of BB of the current @@ -5694,7 +5695,8 @@ inherit_in_ebb (rtx_insn *head, rtx_insn /* This value affects EBB forming. If probability of edge from EBB to a BB is not greater than the following value, we don't add the BB to EBB. */ -#define EBB_PROBABILITY_CUTOFF ((REG_BR_PROB_BASE * 50) / 100) +#define EBB_PROBABILITY_CUTOFF \ + ((REG_BR_PROB_BASE * LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF) / 100) /* Current number of inheritance/split iteration. */ int lra_inheritance_iter; @@ -5740,7 +5742,7 @@ lra_inheritance (void) e = find_fallthru_edge (bb->succs); if (! e) break; - if (e->probability <= EBB_PROBABILITY_CUTOFF) + if (e->probability < EBB_PROBABILITY_CUTOFF) break; bb = bb->next_bb; } Index: doc/invoke.texi =================================================================== --- doc/invoke.texi (revision 220916) +++ doc/invoke.texi (working copy) @@ -10570,6 +10570,14 @@ by this parameter. The default value of the minimal number of registers needed by typical instructions. This value is the best found from numerous experiments. +@item lra-inheritance-ebb-probability-cutoff +LRA tries to reuse values reloaded in registers in subsequent insns. +This optimization is called inheritance. EBB is used as a region to +do this optimization. The parameter defines a minimal fall-through +edge probability in percentage used to add BB to inheritance EBB in +LRA. The default value of the parameter is 40. The value was chosen +from numerous runs of SPEC2000 on x86-64. + @item loop-invariant-max-bbs-in-loop Loop invariant motion can be very expensive, both in compilation time and in amount of needed compile-time memory, with very large loops. Loops