From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7880) id 410BA3858C2C; Tue, 7 Mar 2023 20:09:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 410BA3858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678219766; bh=0+p49ZxPWlfkQgz7VynUaYWqhMWc95c8haYYepgozEo=; h=From:To:Subject:Date:From; b=HskXiFmm31NFQ10jOz0docrWYbnTwMOC3pC8WguhkRqp12zKd2p5IRuQz6IXECR/M 8TiYV38ouj1QQtPAQzOO3F1umLxot59p24ssmUKjkhvJzrX9uHeyuUvvhBvAFPFkel zL9uFF0xrmWZAkWCSoED6XlNCY8E/cYQdWAbtCoo= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Ondrej Kubanek To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/kubaneko/heads/histogram)] fixed error and improved peeling X-Act-Checkin: gcc X-Git-Author: kubaneko X-Git-Refname: refs/users/kubaneko/heads/histogram X-Git-Oldrev: a19d946ebcf24ce1b8387a4ba0c2458901c2324c X-Git-Newrev: 67511ca09d839376168f48582b1c41f0228c29e6 Message-Id: <20230307200926.410BA3858C2C@sourceware.org> Date: Tue, 7 Mar 2023 20:09:26 +0000 (GMT) List-Id: https://gcc.gnu.org/g:67511ca09d839376168f48582b1c41f0228c29e6 commit 67511ca09d839376168f48582b1c41f0228c29e6 Author: kubaneko Date: Wed Mar 1 20:30:09 2023 +0000 fixed error and improved peeling Diff: --- gcc/params.opt | 4 ++++ gcc/tree-ssa-loop-ivcanon.cc | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/params.opt b/gcc/params.opt index 804c5cdbe76..ee21ee7d941 100644 --- a/gcc/params.opt +++ b/gcc/params.opt @@ -882,6 +882,10 @@ Total size of the histogram counter for profile feedback. Common Joined UInteger Var(param_profile_histogram_size_lin) Init(8) Param Optimization Size of the linear portion of the histogram counter for profile feedback. +-param=profile-histogram-peel-prcnt= +Common Joined UInteger Var(param_profile_histogram_peel_prcnt) Init(90) Param Optimization +Peeles if can eliminate at least this percentage of iterations. + -param=profile-func-internal-id= Common Joined UInteger Var(param_profile_func_internal_id) IntegerRange(0, 1) Param Use internal function id in profile lookup. diff --git a/gcc/tree-ssa-loop-ivcanon.cc b/gcc/tree-ssa-loop-ivcanon.cc index 38f947f9e8a..7ef2a3e2525 100644 --- a/gcc/tree-ssa-loop-ivcanon.cc +++ b/gcc/tree-ssa-loop-ivcanon.cc @@ -1045,10 +1045,15 @@ try_peel_loop (class loop *loop, if (sum!=0){ for (int i=0;icounters->hist))[i]; - if ((100*psum)/sum>=90) + if ((100*psum)/sum>=param_profile_histogram_peel_prcnt) { - npeel=i; - continue; + if (i==param_profile_histogram_size_lin-1 && i!=0){ + // Last linear counter absorbs iterations smaller then next power of 2 + npeel=(1<