Propagate unlikely executed BBs even on measured profiles
While looking into AutoFDO porfiles I noticed that sometimes we lost
precise zero counts due to inlining and merging basic blocks. Propagating
precise zero counts should be safe even for measured profiles and thus
this patch enables it.
gcc/ChangeLog:
* predict.cc (unlikely_executed_stmt_p): Remove redundant check.
(rebuild_frequencies): Also recompute unlikely bbs when profile is
present or consistent.
diff --git a/gcc/predict.cc b/gcc/predict.cc
index 5639d81d277..895c5f959d0 100644
--- a/gcc/predict.cc
+++ b/gcc/predict.cc
@@ -852,7 +852,7 @@ unlikely_executed_stmt_p (gimple *stmt)
heuristics. */
if (gimple_bb (stmt)->count.reliable_p ()
&& gimple_bb (stmt)->count.nonzero_p ())
- return gimple_bb (stmt)->count == profile_count::zero ();
+ return false;
/* NORETURN attribute alone is not strong enough: exit() may be quite
likely executed once during program run. */
if (gimple_call_fntype (stmt)
@@ -4521,6 +4521,9 @@ rebuild_frequencies (void)
&& (!uninitialized_count_found || uninitialized_probablity_found)
&& !cfun->cfg->count_max.very_large_p ())
{
+ /* Propagating zero counts should be safe and may
+ help hot/cold splitting. */
+ determine_unlikely_bbs ();
if (dump_file)
fprintf (dump_file, "Profile is consistent\n");
return;
@@ -4545,6 +4548,9 @@ rebuild_frequencies (void)
for a given run, we would only propagate the error further. */
if (feedback_found && !uninitialized_count_found)
{
+ /* Propagating zero counts should be safe and may
+ help hot/cold splitting. */
+ determine_unlikely_bbs ();
if (dump_file)
fprintf (dump_file,
"Profile is inconsistent but read from profile feedback;"