public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/kubaneko/heads/histogram)] added adjusted flag
@ 2023-04-07 10:20 Ondrej Kubanek
0 siblings, 0 replies; only message in thread
From: Ondrej Kubanek @ 2023-04-07 10:20 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:dd74f36d8008ca3b4382f8443e05591d71aadd5a
commit dd74f36d8008ca3b4382f8443e05591d71aadd5a
Author: kubaneko <kubanek0ondrej@gmail.com>
Date: Fri Apr 7 08:26:52 2023 +0000
added adjusted flag
Diff:
---
gcc/cfgloop.cc | 4 +++-
gcc/cfgloop.h | 1 +
gcc/cfgloopmanip.cc | 6 ++++--
gcc/profile.cc | 1 +
4 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/gcc/cfgloop.cc b/gcc/cfgloop.cc
index a4445ddf0a2..3b31792551f 100644
--- a/gcc/cfgloop.cc
+++ b/gcc/cfgloop.cc
@@ -2214,7 +2214,8 @@ void histogram_counters_minus_upper_bound (histogram_counters* hist_c, gcov_type
if (!hist_c || difference==0)
return;
auto& hist=*(hist_c->hist);
- auto& sum=*(hist_c->sum);
+ hist_c->adjusted=true;
+ auto& sum=hist_c->sum;
unsigned int lin_size=param_profile_histogram_size_lin;
unsigned int tot_size=param_profile_histogram_size;
// If the last linear counter does not contain other iterations
@@ -2261,6 +2262,7 @@ void histogram_counters_div_upper_bound (histogram_counters* hist_c, unsigned in
if (hist_c==NULL || divisor<2)
return;
auto& hist=*(hist_c->hist);
+ hist_c->adjusted=true;
unsigned int lin_size=param_profile_histogram_size_lin;
unsigned int tot_size=param_profile_histogram_size;
unsigned int i=1;
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 6a7ef44b8e1..26bb04932bb 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -95,6 +95,7 @@ struct loop_exit_hasher : ggc_ptr_hash<loop_exit>
// Information about histogram of the loop from profiling
struct GTY(()) histogram_counters{
+ bool adjusted;
gcov_type sum;
vec<gcov_type, va_heap, vl_embed> * GTY((skip)) hist;
};
diff --git a/gcc/cfgloopmanip.cc b/gcc/cfgloopmanip.cc
index abc4c2aef13..6f5bc91d82b 100644
--- a/gcc/cfgloopmanip.cc
+++ b/gcc/cfgloopmanip.cc
@@ -1164,8 +1164,10 @@ duplicate_loop_body_to_header_edge (class loop *loop, edge e,
((*loop->counters->hist)[i] ? profile_probability::always()
/(loop->counters->sum-psum) * (*loop->counters->hist)[i]
: profile_probability::never());
- // we do not know whether it was adjusted so we assume so
- scale_step[i].adjusted();
+ // we set whether it was adjusted or is still precise
+ if (loop->counters->adjusted) {
+ scale_step[i].adjusted();
+ }
psum+=(*loop->counters->hist)[i];
}
++i;
diff --git a/gcc/profile.cc b/gcc/profile.cc
index 68b82d22fa2..a8fdebec072 100644
--- a/gcc/profile.cc
+++ b/gcc/profile.cc
@@ -930,6 +930,7 @@ 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->adjusted=false;
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){
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-07 10:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-07 10:20 [gcc(refs/users/kubaneko/heads/histogram)] added adjusted flag 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).