public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/kubaneko/heads/histogram)] fixed peeling bug
@ 2023-04-08 21:06 Ondrej Kubanek
  0 siblings, 0 replies; only message in thread
From: Ondrej Kubanek @ 2023-04-08 21:06 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:085e3f70c96eeb8c00c1555ffadf206133b773ff

commit 085e3f70c96eeb8c00c1555ffadf206133b773ff
Author: kubaneko <kubanek0ondrej@gmail.com>
Date:   Fri Apr 7 21:45:09 2023 +0000

    fixed peeling bug

Diff:
---
 gcc/tree-ssa-loop-ivcanon.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-ssa-loop-ivcanon.cc b/gcc/tree-ssa-loop-ivcanon.cc
index 37111ea02ac..62fea4589ac 100644
--- a/gcc/tree-ssa-loop-ivcanon.cc
+++ b/gcc/tree-ssa-loop-ivcanon.cc
@@ -1039,21 +1039,23 @@ try_peel_loop (class loop *loop,
   bool histogram_peeling=loop->counters!=NULL;
   if (histogram_peeling && loop->counters->sum!=0){
       gcov_type sum=loop->counters->sum;
+      gcov_type rest=sum;
       gcov_type psum=0;
       int good_percentage=param_profile_histogram_peel_prcnt;
       for (int i=0;i<param_profile_histogram_size_lin; i++){
           psum+=(*(loop->counters->hist))[i];
           // iteration has enough cumulated in partial sum and itself has at least 1 percent
           // or we have complete peeling
-          if ((100*psum)/sum>=good_percentage || psum==sum)
+          if ((100*psum)/sum>=good_percentage || 0==rest)
           {
             good_peels.safe_push(i);
             if ((maxiter >= 0 && maxiter <= good_peels.last()) ||
-                    (good_peels.last() > param_max_peel_times - 1)) {
+                    (good_peels.last() > param_max_peel_times - 1) || rest==0) {
                 good_peels.pop();
                break;
             }
             good_percentage=0;
+            rest-=psum;
             psum=0;
           }
           good_percentage+=param_profile_histogram_peel_prcnt;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-08 21:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-08 21:06 [gcc(refs/users/kubaneko/heads/histogram)] fixed peeling bug 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).