aboutsummaryrefslogtreecommitdiff
path: root/gcc/profile.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2020-01-22 12:08:11 +0100
committerMartin Liska <mliska@suse.cz>2020-01-22 12:08:11 +0100
commit5f32f9cf13f99f6295591927950aaf98aa8dba91 (patch)
tree59ab45c6e2d886178d1ca9e17317ffdc1c043c31 /gcc/profile.c
parentf96af171bee93486896407ccad0e1e4dc200bc0c (diff)
downloadgcc-5f32f9cf13f99f6295591927950aaf98aa8dba91.zip
gcc-5f32f9cf13f99f6295591927950aaf98aa8dba91.tar.gz
gcc-5f32f9cf13f99f6295591927950aaf98aa8dba91.tar.bz2
Smart relaxation of TOP N counter.
PR tree-optimization/92924 * profile.c (compute_value_histograms): Divide all counter values. PR tree-optimization/92924 * libgcov-driver.c (prune_topn_counter): New. (prune_counters): Likewise. (dump_one_gcov): Prune a run-time counter. * libgcov-profiler.c (__gcov_topn_values_profiler_body): For a known value, add GCOV_TOPN_VALUES to value. Otherwise, decrement all counters by one.
Diffstat (limited to 'gcc/profile.c')
-rw-r--r--gcc/profile.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/profile.c b/gcc/profile.c
index 6a2de21..cd754c4 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -863,7 +863,15 @@ compute_value_histograms (histogram_values values, unsigned cfg_checksum,
if (hist->type == HIST_TYPE_TOPN_VALUES
|| hist->type == HIST_TYPE_INDIR_CALL)
- sort_hist_values (hist);
+ {
+ /* Each count value is multiplied by GCOV_TOPN_VALUES. */
+ if (hist->hvalue.counters[2] != -1)
+ for (unsigned i = 0; i < GCOV_TOPN_VALUES; i++)
+ hist->hvalue.counters[2 * i + 2]
+ = RDIV (hist->hvalue.counters[2 * i + 2], GCOV_TOPN_VALUES);
+
+ sort_hist_values (hist);
+ }
/* Time profiler counter is not related to any statement,
so that we have to read the counter and set the value to