public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/kubaneko/heads/histogram)] added primitive histogram peeling
@ 2023-02-16 16:28 Ondrej Kubanek
0 siblings, 0 replies; 2+ messages in thread
From: Ondrej Kubanek @ 2023-02-16 16:28 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:4427e303ae942377207924364a3444ce9835b9cf
commit 4427e303ae942377207924364a3444ce9835b9cf
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gcc(refs/users/kubaneko/heads/histogram)] added primitive histogram peeling
@ 2023-02-12 21:36 Ondrej Kubanek
0 siblings, 0 replies; 2+ messages in thread
From: Ondrej Kubanek @ 2023-02-12 21:36 UTC (permalink / raw)
To: gcc-cvs
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-16 16:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-16 16:28 [gcc(refs/users/kubaneko/heads/histogram)] added primitive histogram peeling Ondrej Kubanek
-- strict thread matches above, loose matches on Subject: below --
2023-02-12 21:36 Ondrej Kubanek
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).