From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7880) id 8BECA385840F; Thu, 23 Feb 2023 23:22:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BECA385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677194532; bh=S31qsgKT2tFi4q1l6WTscUOKPv0j8XazKwT1UX1Elqk=; h=From:To:Subject:Date:From; b=XJqAU2eUNVv45I6+/ZlFSwp4csVTOPisxLvKQyGJp7Eq17QWQtEkb+r3iH8hYt80n wW1KQUNnO03qGCKZljiU62+RqBWPG0HBd78xL+VKKlOQwkHBwLdVELoCjOJ8a69ak6 VoVSP+oUMo2Nm0bCb2vgNylKiAd6P/vA9y+4Agjk= 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 memory allocation for histogram_counters X-Act-Checkin: gcc X-Git-Author: kubaneko X-Git-Refname: refs/users/kubaneko/heads/histogram X-Git-Oldrev: 1aa8abc66731f6256653ef54607eb0b759ce1467 X-Git-Newrev: bb8a802b8162eef6934e0961acddc24c70b8ed15 Message-Id: <20230223232212.8BECA385840F@sourceware.org> Date: Thu, 23 Feb 2023 23:22:12 +0000 (GMT) List-Id: https://gcc.gnu.org/g:bb8a802b8162eef6934e0961acddc24c70b8ed15 commit bb8a802b8162eef6934e0961acddc24c70b8ed15 Author: kubaneko Date: Tue Nov 22 13:12:55 2022 +0000 fixed memory allocation for histogram_counters Diff: --- gcc/cfgloop.cc | 4 ++++ gcc/cfgloop.h | 55 ++++++++++++++++--------------------------------------- gcc/profile.cc | 2 +- 3 files changed, 21 insertions(+), 40 deletions(-) diff --git a/gcc/cfgloop.cc b/gcc/cfgloop.cc index 201893f1624..4293f7d3910 100644 --- a/gcc/cfgloop.cc +++ b/gcc/cfgloop.cc @@ -199,6 +199,10 @@ flow_loop_free (class loop *loop) } ggc_free (loop->exits); + if (loop->counters) + { + ggc_free (loop->counters); + } ggc_free (loop); } diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index 7b9a854f266..94a18e56e5e 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -94,50 +94,27 @@ struct loop_exit_hasher : ggc_ptr_hash // Information about histogram of the loop from profiling -struct histogram_counters{ - gcov_type hist[69]; +struct GTY(()) histogram_counters{ gcov_type sum; + int histogram_size; + gcov_type hist[69]; // need to think about overflows // quantil function for the distribution // returns index under which is koef part of the distribution - int quantil(float koef){ - gcc_assert(0hvalue.lp; if (act_count[t]){ - lp->counters=(histogram_counters*) xcalloc (1, sizeof (histogram_counters)); + lp->counters=ggc_alloc(); gcov_type sum=0; for (int i=0;i<69;++i){ lp->counters->hist[i]=act_count[t][i];