Commit 0418f237 by Jan Hubicka Committed by Jan Hubicka

coverage.c (struct conts_entry): Add n_counts.


	* coverage.c (struct conts_entry): Add n_counts.
	(remap_counts_file): Record number of ocunts.
	(get_coverage_counts): Verify that counts match.
	* coverage.h (get_coverage_counts): Update prototype.
	* profile.c (get_exec_counts. compute_value_histograms): Add
	n_counts parametrs.

From-SVN: r267200
parent d7c00826
2018-12-15 Jan Hubicka <hubicka@ucw.cz>
* coverage.c (struct conts_entry): Add n_counts.
(remap_counts_file): Record number of ocunts.
(get_coverage_counts): Verify that counts match.
* coverage.h (get_coverage_counts): Update prototype.
* profile.c (get_exec_counts. compute_value_histograms): Add
n_counts parametrs.
2018-12-17 Senthil Kumar Selvaraj <senthilkumar.selvaraj@microchip.com> 2018-12-17 Senthil Kumar Selvaraj <senthilkumar.selvaraj@microchip.com>
PR rtl-optimization/88253 PR rtl-optimization/88253
...@@ -74,6 +74,7 @@ struct counts_entry : pointer_hash <counts_entry> ...@@ -74,6 +74,7 @@ struct counts_entry : pointer_hash <counts_entry>
unsigned lineno_checksum; unsigned lineno_checksum;
unsigned cfg_checksum; unsigned cfg_checksum;
gcov_type *counts; gcov_type *counts;
unsigned n_counts;
/* hash_table support. */ /* hash_table support. */
static inline hashval_t hash (const counts_entry *); static inline hashval_t hash (const counts_entry *);
...@@ -260,6 +261,7 @@ read_counts_file (void) ...@@ -260,6 +261,7 @@ read_counts_file (void)
entry->lineno_checksum = lineno_checksum; entry->lineno_checksum = lineno_checksum;
entry->cfg_checksum = cfg_checksum; entry->cfg_checksum = cfg_checksum;
entry->counts = XCNEWVEC (gcov_type, n_counts); entry->counts = XCNEWVEC (gcov_type, n_counts);
entry->n_counts = n_counts;
} }
else if (entry->lineno_checksum != lineno_checksum else if (entry->lineno_checksum != lineno_checksum
|| entry->cfg_checksum != cfg_checksum) || entry->cfg_checksum != cfg_checksum)
...@@ -295,7 +297,7 @@ read_counts_file (void) ...@@ -295,7 +297,7 @@ read_counts_file (void)
gcov_type * gcov_type *
get_coverage_counts (unsigned counter, unsigned cfg_checksum, get_coverage_counts (unsigned counter, unsigned cfg_checksum,
unsigned lineno_checksum) unsigned lineno_checksum, unsigned int n_counts)
{ {
counts_entry *entry, elt; counts_entry *entry, elt;
...@@ -344,17 +346,27 @@ get_coverage_counts (unsigned counter, unsigned cfg_checksum, ...@@ -344,17 +346,27 @@ get_coverage_counts (unsigned counter, unsigned cfg_checksum,
return NULL; return NULL;
} }
if (entry->cfg_checksum != cfg_checksum) if (entry->cfg_checksum != cfg_checksum || entry->n_counts != n_counts)
{ {
static int warned = 0; static int warned = 0;
bool warning_printed = false; bool warning_printed = false;
warning_printed = if (entry->n_counts != n_counts)
warning_at (DECL_SOURCE_LOCATION (current_function_decl), warning_printed =
OPT_Wcoverage_mismatch, warning_at (DECL_SOURCE_LOCATION (current_function_decl),
"the control flow of function %qD does not match " OPT_Wcoverage_mismatch,
"its profile data (counter %qs)", current_function_decl, "number of counters in profile data for function %qD "
ctr_names[counter]); "does not match "
"its profile data (counter %qs, expected %i and have %i)",
current_function_decl,
ctr_names[counter], entry->n_counts, n_counts);
else
warning_printed =
warning_at (DECL_SOURCE_LOCATION (current_function_decl),
OPT_Wcoverage_mismatch,
"the control flow of function %qD does not match "
"its profile data (counter %qs)", current_function_decl,
ctr_names[counter]);
if (warning_printed && dump_enabled_p ()) if (warning_printed && dump_enabled_p ())
{ {
dump_user_location_t loc dump_user_location_t loc
......
...@@ -52,7 +52,8 @@ extern tree tree_coverage_counter_addr (unsigned /*counter*/, unsigned/*num*/); ...@@ -52,7 +52,8 @@ extern tree tree_coverage_counter_addr (unsigned /*counter*/, unsigned/*num*/);
/* Get all the counters for the current function. */ /* Get all the counters for the current function. */
extern gcov_type *get_coverage_counts (unsigned /*counter*/, extern gcov_type *get_coverage_counts (unsigned /*counter*/,
unsigned /*cfg_checksum*/, unsigned /*cfg_checksum*/,
unsigned /*lineno_checksum*/); unsigned /*lineno_checksum*/,
unsigned /*n_counts*/);
extern tree get_gcov_type (void); extern tree get_gcov_type (void);
extern bool coverage_node_map_initialized_p (void); extern bool coverage_node_map_initialized_p (void);
......
...@@ -218,7 +218,7 @@ get_exec_counts (unsigned cfg_checksum, unsigned lineno_checksum) ...@@ -218,7 +218,7 @@ get_exec_counts (unsigned cfg_checksum, unsigned lineno_checksum)
} }
counts = get_coverage_counts (GCOV_COUNTER_ARCS, cfg_checksum, counts = get_coverage_counts (GCOV_COUNTER_ARCS, cfg_checksum,
lineno_checksum); lineno_checksum, num_edges);
if (!counts) if (!counts)
return NULL; return NULL;
...@@ -780,7 +780,8 @@ compute_value_histograms (histogram_values values, unsigned cfg_checksum, ...@@ -780,7 +780,8 @@ compute_value_histograms (histogram_values values, unsigned cfg_checksum,
histogram_counts[t] = get_coverage_counts (COUNTER_FOR_HIST_TYPE (t), histogram_counts[t] = get_coverage_counts (COUNTER_FOR_HIST_TYPE (t),
cfg_checksum, cfg_checksum,
lineno_checksum); lineno_checksum,
n_histogram_counters[t]);
if (histogram_counts[t]) if (histogram_counts[t])
any = 1; any = 1;
act_count[t] = histogram_counts[t]; act_count[t] = histogram_counts[t];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment