From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7880) id C5AAC3858426; Mon, 27 Mar 2023 16:00:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C5AAC3858426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679932805; bh=tdFvzapj3WR1OX185extJEDv67seWpaH+L0WscTIYjM=; h=From:To:Subject:Date:From; b=rvugJJ98KoA9gguHxJ/8bcsXkf6ckBNkDchP2x12G5gDg2jFy05x1Vq5sP62Ew7ir CNS+DuVULGqQAfaiZ8mGrlCmd5ry0Kx3STEPjrm/Rj/nSfe+kW30Aq3tKYFFh3zgMX CvvaaIf/te62WkVKCaKdgZGMuFs8V2ux58+/Rg2s= 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)] changed where iterations between linear portion and the next pow2 go X-Act-Checkin: gcc X-Git-Author: kubaneko X-Git-Refname: refs/users/kubaneko/heads/histogram X-Git-Oldrev: 1a48dd67570170bc0e6e5280da6061bf33ff1a02 X-Git-Newrev: c69efdb5f4066002938f70b9f9220af488473761 Message-Id: <20230327160005.C5AAC3858426@sourceware.org> Date: Mon, 27 Mar 2023 16:00:05 +0000 (GMT) List-Id: https://gcc.gnu.org/g:c69efdb5f4066002938f70b9f9220af488473761 commit c69efdb5f4066002938f70b9f9220af488473761 Author: kubaneko Date: Mon Mar 27 15:59:53 2023 +0000 changed where iterations between linear portion and the next pow2 go Diff: --- gcc/cfgloop.cc | 43 ++++++++++++++++++++++++------------------- libgcc/libgcov-profiler.c | 6 ++++-- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/gcc/cfgloop.cc b/gcc/cfgloop.cc index 6b4412568d1..3c66e7962c6 100644 --- a/gcc/cfgloop.cc +++ b/gcc/cfgloop.cc @@ -2186,19 +2186,28 @@ loops_list::walk_loop_tree (class loop *root, unsigned flags) } unsigned int hist_index(gcov_type_unsigned val){ - unsigned int lin_size=param_profile_histogram_size_lin; - unsigned int tot_size=param_profile_histogram_size; - if (valpow2){ - return pow2+(lin_size-lin_pow2)-1; - } else { - return tot_size-1; - } - } + unsigned int lin_size = param_profile_histogram_size_lin; + unsigned int tot_size = param_profile_histogram_size; + if (val < lin_size) + { + return val; + } + else + { + gcov_type_unsigned pow2 = floor_log2 (val); + gcov_type_unsigned lin_pow2 = floor_log2 (lin_size - 1); + if (lin_size pow2 + ((lin_size - 1) - lin_pow2)) + { + return pow2 + ((lin_size - 1)- lin_pow2); + } + else + { + return tot_size - 1; + } + } } void histogram_counters_minus_upper_bound (histogram_counters* hist_c, gcov_type_unsigned difference){ @@ -2207,13 +2216,9 @@ void histogram_counters_minus_upper_bound (histogram_counters* hist_c, gcov_type auto hist=*(hist_c->hist); unsigned int lin_size=param_profile_histogram_size_lin; unsigned int tot_size=param_profile_histogram_size; - - // next power of 2 for linear hist - unsigned int lin_size_upp=1<pow2){ + if (lin_sizepow2){ counters[pow2+(lin_size-lin_pow2)-1]++; } else { counters[tot_size-1]++; - } + }} } }