Commit 732779d0 by Indu Bhagat Committed by Jeff Law

coverage.c (get_coverage_counts): Use from_function_decl for precise function location.

	* coverage.c (get_coverage_counts): Use from_function_decl for precise
	function location.
	* profile-count.c (profile_count::dump): Add handling for precise
	profile quality.
	* profile.c (compute_branch_probabilities): Rely on exec_counts instead
	of profile_info to set profile_status of function.
	(branch_prob): Do not set profile_status of function based on
	profile_info. Done above based on exec_counts.

From-SVN: r266702
parent 4df6a906
2018-11-30 Indu Bhagat <indu.bhagat@oracle.com>
* coverage.c (get_coverage_counts): Use from_function_decl for precise
function location.
* profile-count.c (profile_count::dump): Add handling for precise
profile quality.
* profile.c (compute_branch_probabilities): Rely on exec_counts instead
of profile_info to set profile_status of function.
(branch_prob): Do not set profile_status of function based on
profile_info. Done above based on exec_counts.
2018-11-30 Jakub Jelinek <jakub@redhat.com> 2018-11-30 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/88274 PR tree-optimization/88274
...@@ -358,7 +358,7 @@ get_coverage_counts (unsigned counter, unsigned cfg_checksum, ...@@ -358,7 +358,7 @@ get_coverage_counts (unsigned counter, unsigned cfg_checksum,
if (warning_printed && dump_enabled_p ()) if (warning_printed && dump_enabled_p ())
{ {
dump_user_location_t loc dump_user_location_t loc
= dump_user_location_t::from_location_t (input_location); = dump_user_location_t::from_function_decl (current_function_decl);
dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc, dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
"use -Wno-error=coverage-mismatch to tolerate " "use -Wno-error=coverage-mismatch to tolerate "
"the mismatch but performance may drop if the " "the mismatch but performance may drop if the "
......
...@@ -83,6 +83,8 @@ profile_count::dump (FILE *f) const ...@@ -83,6 +83,8 @@ profile_count::dump (FILE *f) const
fprintf (f, " (auto FDO)"); fprintf (f, " (auto FDO)");
else if (m_quality == profile_guessed) else if (m_quality == profile_guessed)
fprintf (f, " (guessed)"); fprintf (f, " (guessed)");
else if (m_quality == profile_precise)
fprintf (f, " (precise)");
} }
} }
......
...@@ -698,6 +698,9 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum) ...@@ -698,6 +698,9 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
} }
} }
if (exec_counts)
profile_status_for_fn (cfun) = PROFILE_READ;
/* If we have real data, use them! */ /* If we have real data, use them! */
if (bb_gcov_count (ENTRY_BLOCK_PTR_FOR_FN (cfun)) if (bb_gcov_count (ENTRY_BLOCK_PTR_FOR_FN (cfun))
|| !flag_guess_branch_prob) || !flag_guess_branch_prob)
...@@ -705,7 +708,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum) ...@@ -705,7 +708,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
bb->count = profile_count::from_gcov_type (bb_gcov_count (bb)); bb->count = profile_count::from_gcov_type (bb_gcov_count (bb));
/* If function was not trained, preserve local estimates including statically /* If function was not trained, preserve local estimates including statically
determined zero counts. */ determined zero counts. */
else else if (profile_status_for_fn (cfun) == PROFILE_READ)
FOR_ALL_BB_FN (bb, cfun) FOR_ALL_BB_FN (bb, cfun)
if (!(bb->count == profile_count::zero ())) if (!(bb->count == profile_count::zero ()))
bb->count = bb->count.global0 (); bb->count = bb->count.global0 ();
...@@ -718,6 +721,11 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum) ...@@ -718,6 +721,11 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
if (dump_file) if (dump_file)
{ {
fprintf (dump_file, " Profile feedback for function");
fprintf (dump_file, ((profile_status_for_fn (cfun) == PROFILE_READ)
? " is available \n"
: " is not available \n"));
fprintf (dump_file, "%d branches\n", num_branches); fprintf (dump_file, "%d branches\n", num_branches);
if (num_branches) if (num_branches)
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
...@@ -1317,12 +1325,12 @@ branch_prob (void) ...@@ -1317,12 +1325,12 @@ branch_prob (void)
values.release (); values.release ();
free_edge_list (el); free_edge_list (el);
coverage_end_function (lineno_checksum, cfg_checksum); coverage_end_function (lineno_checksum, cfg_checksum);
if (flag_branch_probabilities && profile_info) if (flag_branch_probabilities
&& (profile_status_for_fn (cfun) == PROFILE_READ))
{ {
struct loop *loop; struct loop *loop;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
report_predictor_hitrates (); report_predictor_hitrates ();
profile_status_for_fn (cfun) = PROFILE_READ;
/* At this moment we have precise loop iteration count estimates. /* At this moment we have precise loop iteration count estimates.
Record them to loop structure before the profile gets out of date. */ Record them to loop structure before the profile gets out of date. */
......
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