From 5f32f9cf13f99f6295591927950aaf98aa8dba91 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 22 Jan 2020 12:08:11 +0100 Subject: 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. --- gcc/ChangeLog | 6 ++++++ gcc/profile.c | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d3a7bc2..f672e93 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-01-22 Martin Liska + + PR tree-optimization/92924 + * profile.c (compute_value_histograms): Divide + all counter values. + 2020-01-22 Jakub Jelinek PR target/91298 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 -- cgit v1.1