diff options
author | Martin Liska <mliska@suse.cz> | 2021-01-22 11:27:16 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2021-01-25 13:30:34 +0100 |
commit | 5089df534b85b795bfcdca8f4f1957ad15a60558 (patch) | |
tree | f21b8220b0cd8cbcba3210bd32e229a3b62cacce /gcc | |
parent | defc40db9e09ecceb2d71727031fe9579bce1b11 (diff) | |
download | gcc-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 'gcc')
-rw-r--r-- | gcc/common.opt | 2 | ||||
-rw-r--r-- | gcc/value-prof.c | 26 |
2 files changed, 21 insertions, 7 deletions
diff --git a/gcc/common.opt b/gcc/common.opt index bde1711..a8a2b67 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -2248,7 +2248,7 @@ Enum(profile_reproducibility) String(parallel-runs) Value(PROFILE_REPRODUCIBILIT EnumValue Enum(profile_reproducibility) String(multithreaded) Value(PROFILE_REPRODUCIBILITY_MULTITHREADED) -fprofile-reproducible +fprofile-reproducible= Common Joined RejectNegative Var(flag_profile_reproducible) Enum(profile_reproducibility) Init(PROFILE_REPRODUCIBILITY_SERIAL) -fprofile-reproducible=[serial|parallel-runs|multithreaded] Control level of reproducibility of profile gathered by -fprofile-generate. diff --git a/gcc/value-prof.c b/gcc/value-prof.c index 4c916f4..3e899a3 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -747,8 +747,8 @@ gimple_divmod_fixed_value (gassign *stmt, tree value, profile_probability prob, abs (counters[0]) is the number of executions for i in 0 ... TOPN-1 - counters[2 * i + 1] is target - abs (counters[2 * i + 2]) is corresponding hitrate counter. + counters[2 * i + 2] is target + counters[2 * i + 3] is corresponding hitrate counter. Value of counters[0] negative when counter became full during merging and some values are lost. */ @@ -766,15 +766,29 @@ get_nth_most_common_value (gimple *stmt, const char *counter_type, *value = 0; gcov_type read_all = abs_hwi (hist->hvalue.counters[0]); + gcov_type covered = 0; + for (unsigned i = 0; i < counters; ++i) + covered += hist->hvalue.counters[2 * i + 3]; gcov_type v = hist->hvalue.counters[2 * n + 2]; gcov_type c = hist->hvalue.counters[2 * n + 3]; if (hist->hvalue.counters[0] < 0 - && (flag_profile_reproducible == PROFILE_REPRODUCIBILITY_PARALLEL_RUNS - || (flag_profile_reproducible - == PROFILE_REPRODUCIBILITY_MULTITHREADED))) - return false; + && flag_profile_reproducible == PROFILE_REPRODUCIBILITY_PARALLEL_RUNS) + { + if (dump_file) + fprintf (dump_file, "Histogram value dropped in %qs mode", + "-fprofile-reproducible=parallel-runs"); + return false; + } + else if (covered != read_all + && flag_profile_reproducible == PROFILE_REPRODUCIBILITY_MULTITHREADED) + { + if (dump_file) + fprintf (dump_file, "Histogram value dropped in %qs mode", + "-fprofile-reproducible=multithreaded"); + return false; + } /* Indirect calls can't be verified. */ if (stmt |