Hi,
it seems that there is additional bug in merging which caused the extra
0 counts.
The attached patch imprves the stats on gcc dir of profiledbootstrap:
stats for indirect_call:
total: 9876
invalid: 705
tracked values:
0 values: 7189 times (72.79%)
1 values: 1890 times (19.14%)
2 values: 50 times (0.51%)
3 values: 20 times (0.20%)
4 values: 22 times (0.22%)
stats for topn:
total: 1527
invalid: 150
tracked values:
0 values: 1193 times (78.13%)
1 values: 150 times (9.82%)
2 values: 16 times (1.05%)
3 values: 9 times (0.59%)
4 values: 9 times (0.59%)
to:
stats for indirect_call:
total: 9876
invalid: 769
tracked values:
0 values: 6289 times (63.68%)
1 values: 2383 times (24.13%)
2 values: 293 times (2.97%)
3 values: 142 times (1.44%)
4 values: 0 times (0.00%)
stats for topn:
total: 1527
invalid: 205
tracked values:
0 values: 1038 times (67.98%)
1 values: 166 times (10.87%)
2 values: 65 times (4.26%)
3 values: 51 times (3.34%)
4 values: 2 times (0.13%)
I plan to commit it tomorrow.
It bootstraped x86_64-linux, regtesting is running.
Stll the number of invalidated counters outnumbers those sucesfully
tracked which are not trivial (0 or 1 val).
libgcc/ChangeLog:
2020-01-24 Jan Hubicka <[email protected]>
* libgcov-merge.c (merge_topn_values_set): Fix merging.
diff --git a/libgcc/libgcov-merge.c b/libgcc/libgcov-merge.c
index b658aec46c6..19b8ee72ae9 100644
--- a/libgcc/libgcov-merge.c
+++ b/libgcc/libgcov-merge.c
@@ -112,9 +112,11 @@ merge_topn_values_set (gcov_type *counters)
for (unsigned i = 0; i < GCOV_TOPN_VALUES; i++)
{
if (read_counters[2 * i + 1] == 0)
- return;
+ continue;
unsigned j;
+ int slot = -1;
+
for (j = 0; j < GCOV_TOPN_VALUES; j++)
{
if (counters[2 * j] == read_counters[2 * i])
@@ -123,18 +125,23 @@ merge_topn_values_set (gcov_type *counters)
break;
}
else if (counters[2 * j + 1] == 0)
- {
- counters[2 * j] += read_counters[2 * i];
- counters[2 * j + 1] += read_counters[2 * i + 1];
- break;
- }
+ slot = j;
}
- /* We haven't found a slot, bail out. */
if (j == GCOV_TOPN_VALUES)
{
- counters[1] = -1;
- return;
+ if (slot > 0)
+ {
+ /* If we found empty slot, add the value. */
+ counters[2 * slot] = read_counters[2 * i];
+ counters[2 * slot + 1] = read_counters[2 * i + 1];
+ }
+ else
+ {
+ /* We haven't found a slot, bail out. */
+ counters[1] = -1;
+ return;
+ }
}
}
}