aboutsummaryrefslogtreecommitdiff
path: root/libgcc/libgcov-merge.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-01-22 11:27:16 +0100
committerMartin Liska <mliska@suse.cz>2021-01-25 13:30:34 +0100
commit5089df534b85b795bfcdca8f4f1957ad15a60558 (patch)
treef21b8220b0cd8cbcba3210bd32e229a3b62cacce /libgcc/libgcov-merge.c
parentdefc40db9e09ecceb2d71727031fe9579bce1b11 (diff)
downloadgcc-5089df534b85b795bfcdca8f4f1957ad15a60558.zip
gcc-5089df534b85b795bfcdca8f4f1957ad15a60558.tar.gz
gcc-5089df534b85b795bfcdca8f4f1957ad15a60558.tar.bz2
Restore profile reproducibility.
gcc/ChangeLog: PR gcov-profile/98739 * common.opt: Add missing sign symbol. * value-prof.c (get_nth_most_common_value): Restore handling of PROFILE_REPRODUCIBILITY_PARALLEL_RUNS and PROFILE_REPRODUCIBILITY_MULTITHREADED. libgcc/ChangeLog: PR gcov-profile/98739 * libgcov-merge.c (__gcov_merge_topn): Mark when merging ends with a dropped counter. * libgcov.h (gcov_topn_add_value): Add return value.
Diffstat (limited to 'libgcc/libgcov-merge.c')
-rw-r--r--libgcc/libgcov-merge.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libgcc/libgcov-merge.c b/libgcc/libgcov-merge.c
index 9306e8d..7db188a 100644
--- a/libgcc/libgcov-merge.c
+++ b/libgcc/libgcov-merge.c
@@ -94,6 +94,9 @@ __gcov_merge_time_profile (gcov_type *counters, unsigned n_counters)
-- the stored candidate on the most common value of the measured entity
-- counter
+
+ We use -TOTAL for situation when merging dropped some values.
+ The information is used for -fprofile-reproducible flag.
*/
void
@@ -107,7 +110,9 @@ __gcov_merge_topn (gcov_type *counters, unsigned n_counters)
gcov_type all = gcov_get_counter_ignore_scaling (-1);
gcov_type n = gcov_get_counter_ignore_scaling (-1);
- counters[GCOV_TOPN_MEM_COUNTERS * i] += all;
+ unsigned full = all < 0;
+ gcov_type *total = &counters[GCOV_TOPN_MEM_COUNTERS * i];
+ *total += full ? -all : all;
for (unsigned j = 0; j < n; j++)
{
@@ -115,9 +120,12 @@ __gcov_merge_topn (gcov_type *counters, unsigned n_counters)
gcov_type count = gcov_get_counter_ignore_scaling (-1);
// TODO: we should use atomic here
- gcov_topn_add_value (counters + GCOV_TOPN_MEM_COUNTERS * i, value,
- count, 0, 0);
+ full |= gcov_topn_add_value (counters + GCOV_TOPN_MEM_COUNTERS * i,
+ value, count, 0, 0);
}
+
+ if (full)
+ *total = -(*total);
}
}
#endif /* L_gcov_merge_topn */