aboutsummaryrefslogtreecommitdiff
path: root/gcc/coverage.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2018-06-05 10:13:31 +0200
committerMartin Liska <marxin@gcc.gnu.org>2018-06-05 08:13:31 +0000
commit7f3577f5285957c1aa48823ce6c691f8c212b219 (patch)
tree5127bd697a20fb3805447c7cd1857b52f04112ae /gcc/coverage.c
parent632b10e14156db1e429f623628ad4f270c1550c4 (diff)
downloadgcc-7f3577f5285957c1aa48823ce6c691f8c212b219.zip
gcc-7f3577f5285957c1aa48823ce6c691f8c212b219.tar.gz
gcc-7f3577f5285957c1aa48823ce6c691f8c212b219.tar.bz2
Simplify gcov_histogram as it's used only for ARCS counters.
2018-06-05 Martin Liska <mliska@suse.cz> * auto-profile.c (read_autofdo_file): Do not use gcov_ctr_summary struct. (afdo_callsite_hot_enough_for_early_inline): Likewise. * coverage.c (struct counts_entry): Likewise. (read_counts_file): Read just single summary entry. (get_coverage_counts): Use gcov_summary struct. * coverage.h (get_coverage_counts): Likewise. * gcov-dump.c (dump_working_sets): Likewise. (tag_summary): Dump just single summary. * gcov-io.c (gcov_write_summary): Write just histogram summary. (gcov_read_summary): Read just single summary. (compute_working_sets): Use gcov_summary struct. * gcov-io.h (GCOV_TAG_SUMMARY_LENGTH): Remove usage of GCOV_COUNTERS_SUMMABLE. (GCOV_COUNTERS_SUMMABLE): Remove. (GCOV_FIRST_VALUE_COUNTER): Replace with GCOV_COUNTER_V_INTERVAL. (struct gcov_ctr_summary): Remove. (struct gcov_summary): Directly use fields of former gcov_ctr_summary. (compute_working_sets): Use gcov_summary struct. * gcov.c (read_count_file): Do not use ctrs fields. * lto-cgraph.c (merge_profile_summaries): Use gcov_summary struct. * lto-streamer.h (struct GTY): Make profile_info gcov_summary struct. * profile.c: Likewise. * profile.h: Likewise. 2018-06-05 Martin Liska <mliska@suse.cz> * libgcov-driver.c (gcov_compute_histogram): Remove usage of gcov_ctr_summary. (compute_summary): Do it just for a single summary. (merge_one_data): Likewise. (merge_summary): Simplify as we read just single summary. (dump_one_gcov): Pass proper argument. * libgcov-util.c (compute_one_gcov): Simplify as we have just single summary. (gcov_info_count_all_cold): Likewise. (calculate_overlap): Likewise. From-SVN: r261189
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r--gcc/coverage.c49
1 files changed, 18 insertions, 31 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 9e0185a..84fff13 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -73,7 +73,7 @@ struct counts_entry : pointer_hash <counts_entry>
unsigned lineno_checksum;
unsigned cfg_checksum;
gcov_type *counts;
- struct gcov_ctr_summary summary;
+ gcov_summary summary;
/* hash_table support. */
static inline hashval_t hash (const counts_entry *);
@@ -185,7 +185,7 @@ static void
read_counts_file (void)
{
gcov_unsigned_t fn_ident = 0;
- struct gcov_summary summary;
+ gcov_summary summary;
unsigned new_summary = 1;
gcov_unsigned_t tag;
int is_error = 0;
@@ -241,27 +241,21 @@ read_counts_file (void)
else if (tag == GCOV_TAG_PROGRAM_SUMMARY)
{
struct gcov_summary sum;
- unsigned ix;
if (new_summary)
memset (&summary, 0, sizeof (summary));
gcov_read_summary (&sum);
- for (ix = 0; ix != GCOV_COUNTERS_SUMMABLE; ix++)
- {
- summary.ctrs[ix].runs += sum.ctrs[ix].runs;
- summary.ctrs[ix].sum_all += sum.ctrs[ix].sum_all;
- if (summary.ctrs[ix].run_max < sum.ctrs[ix].run_max)
- summary.ctrs[ix].run_max = sum.ctrs[ix].run_max;
- summary.ctrs[ix].sum_max += sum.ctrs[ix].sum_max;
- }
+ summary.runs += sum.runs;
+ summary.sum_all += sum.sum_all;
+ if (summary.run_max < sum.run_max)
+ summary.run_max = sum.run_max;
+ summary.sum_max += sum.sum_max;
if (new_summary)
- memcpy (summary.ctrs[GCOV_COUNTER_ARCS].histogram,
- sum.ctrs[GCOV_COUNTER_ARCS].histogram,
- sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE);
+ memcpy (summary.histogram, sum.histogram,
+ sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE);
else
- gcov_histogram_merge (summary.ctrs[GCOV_COUNTER_ARCS].histogram,
- sum.ctrs[GCOV_COUNTER_ARCS].histogram);
+ gcov_histogram_merge (summary.histogram, sum.histogram);
new_summary = 0;
}
else if (GCOV_TAG_IS_COUNTER (tag) && fn_ident)
@@ -282,8 +276,8 @@ read_counts_file (void)
entry->ctr = elt.ctr;
entry->lineno_checksum = lineno_checksum;
entry->cfg_checksum = cfg_checksum;
- if (elt.ctr < GCOV_COUNTERS_SUMMABLE)
- entry->summary = summary.ctrs[elt.ctr];
+ if (elt.ctr == GCOV_COUNTER_ARCS)
+ entry->summary = summary;
entry->summary.num = n_counts;
entry->counts = XCNEWVEC (gcov_type, n_counts);
}
@@ -306,23 +300,16 @@ read_counts_file (void)
counts_hash = NULL;
break;
}
- else if (elt.ctr >= GCOV_COUNTERS_SUMMABLE)
- {
- error ("cannot merge separate %s counters for function %u",
- ctr_names[elt.ctr], fn_ident);
- goto skip_merge;
- }
else
{
- entry->summary.runs += summary.ctrs[elt.ctr].runs;
- entry->summary.sum_all += summary.ctrs[elt.ctr].sum_all;
- if (entry->summary.run_max < summary.ctrs[elt.ctr].run_max)
- entry->summary.run_max = summary.ctrs[elt.ctr].run_max;
- entry->summary.sum_max += summary.ctrs[elt.ctr].sum_max;
+ entry->summary.runs += summary.runs;
+ entry->summary.sum_all += summary.sum_all;
+ if (entry->summary.run_max < summary.run_max)
+ entry->summary.run_max = summary.run_max;
+ entry->summary.sum_max += summary.sum_max;
}
for (ix = 0; ix != n_counts; ix++)
entry->counts[ix] += gcov_read_counter ();
- skip_merge:;
}
gcov_sync (offset, length);
if ((is_error = gcov_is_error ()))
@@ -345,7 +332,7 @@ read_counts_file (void)
gcov_type *
get_coverage_counts (unsigned counter, unsigned expected,
unsigned cfg_checksum, unsigned lineno_checksum,
- const struct gcov_ctr_summary **summary)
+ const gcov_summary **summary)
{
counts_entry *entry, elt;