public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Ondrej Kubanek <kubaneko@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/kubaneko/heads/histogram)] added primitive histogram peeling Date: Sun, 12 Feb 2023 21:36:31 +0000 (GMT) [thread overview] Message-ID: <20230212213631.23DDF3858D32@sourceware.org> (raw) https://gcc.gnu.org/g:91082983c3f2f06ffa39814b6b4ca1c2dcc249c1 commit 91082983c3f2f06ffa39814b6b4ca1c2dcc249c1 Author: kubaneko <kubanek0ondrej@gmail.com> Date: Sun Feb 12 21:33:50 2023 +0000 added primitive histogram peeling Diff: --- gcc/tree-ssa-loop-ivcanon.cc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/gcc/tree-ssa-loop-ivcanon.cc b/gcc/tree-ssa-loop-ivcanon.cc index c36efe28dc2..9858d11fcd9 100644 --- a/gcc/tree-ssa-loop-ivcanon.cc +++ b/gcc/tree-ssa-loop-ivcanon.cc @@ -1037,20 +1037,20 @@ try_peel_loop (class loop *loop, npeel = estimated_loop_iterations_int (loop); // linear part most common number - //bool histogram_peeling=loop->counters!=NULL; - //if (histogram_peeling){ - // gcov_type max=0; - // int most_common=-1; - // for (int i=0;i<8; i++){ - // if (loop->counters->hist[i]>=max){ - // most_common=i; - // } - // } - // if (most_common>0) - // { - // npeel=most_common+1; - // } - //} + // peels if in linear portion there is more then 90% of iterations + bool histogram_peeling=loop->counters!=NULL; + if (histogram_peeling){ + gcov_type psum=0; + gcov_type sum=loop->counters->sum; + for (int i=0;i<param_profile_histogram_size_lin; i++){ + psum+=(*(loop->counters->hist))[i]; + if ((100*psum)/sum>=90) + { + npeel=i; + continue; + } + } + } if (npeel < 0) npeel = likely_max_loop_iterations_int (loop);
next reply other threads:[~2023-02-12 21:36 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-12 21:36 Ondrej Kubanek [this message] 2023-02-16 16:28 Ondrej Kubanek
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230212213631.23DDF3858D32@sourceware.org \ --to=kubaneko@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).