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)] fixed vector allocation
Date: Thu, 23 Feb 2023 23:22:43 +0000 (GMT)	[thread overview]
Message-ID: <20230223232243.09DED385B50D@sourceware.org> (raw)

https://gcc.gnu.org/g:98d59dcdebb492055ca7d648abc475bfafdfd3e5

commit 98d59dcdebb492055ca7d648abc475bfafdfd3e5
Author: kubaneko <kubanek0ondrej@gmail.com>
Date:   Sat Jan 14 22:04:29 2023 +0000

    fixed vector allocation

Diff:
---
 gcc/cfgloop.h  | 2 +-
 gcc/profile.cc | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index b6a005450a8..14945bc967d 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -97,7 +97,7 @@ struct loop_exit_hasher : ggc_ptr_hash<loop_exit>
 struct GTY(()) histogram_counters{
     gcov_type sum;
     int histogram_size;
-    vec<gcov_type, va_heap> * GTY((skip)) hist;
+    vec<gcov_type, va_heap, vl_embed> * GTY((skip)) hist;
 };
 
 // quantil function for the distribution
diff --git a/gcc/profile.cc b/gcc/profile.cc
index f4dfe575c61..dbe005a1d39 100644
--- a/gcc/profile.cc
+++ b/gcc/profile.cc
@@ -930,13 +930,14 @@ compute_value_histograms (histogram_values values, unsigned cfg_checksum,
         if (act_count[t]){
            lp->counters=ggc_alloc<histogram_counters>();
            gcov_type sum=0;
+           lp->counters->hist=NULL;
+           vec_safe_grow_cleared(lp->counters->hist,param_profile_histogram_size);
            for (int i=0;i<param_profile_histogram_size;++i){
                auto hst=lp->counters->hist;
                (*hst)[i]=act_count[t][i];
                sum+=act_count[t][i];
            }
            lp->counters->sum=sum;
-           vec_safe_grow_cleared(lp->counters->hist,param_profile_histogram_size);
         }
         continue;
       }

             reply	other threads:[~2023-02-23 23:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 23:22 Ondrej Kubanek [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-02-16 16:28 Ondrej Kubanek
2023-01-14 22:04 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=20230223232243.09DED385B50D@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: link
Be 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).