aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Rozenfeld <erozen@microsoft.com>2023-09-15 18:12:47 -0700
committerEugene Rozenfeld <erozen@microsoft.com>2023-10-09 13:07:11 -0700
commitcc50337215535e17f1caa5eae34eaa650223c96b (patch)
tree79d91b5608276597792b61f7186d77796128a66a
parent08d0f840dc7ad212ab75d094373b01cbfc004e67 (diff)
downloadgcc-cc50337215535e17f1caa5eae34eaa650223c96b.zip
gcc-cc50337215535e17f1caa5eae34eaa650223c96b.tar.gz
gcc-cc50337215535e17f1caa5eae34eaa650223c96b.tar.bz2
Fixes for profile count/probability maintenance
Verifier checks have recently been strengthened to check that all counts and probabilities are initialized. The checks fired during autoprofiledbootstrap build and this patch fixes it. Tested on x86_64-pc-linux-gnu. gcc/ChangeLog: * auto-profile.cc (afdo_calculate_branch_prob): Fix count comparisons * tree-vect-loop-manip.cc (vect_do_peeling): Guard against zero count when scaling loop profile
-rw-r--r--gcc/auto-profile.cc4
-rw-r--r--gcc/tree-vect-loop-manip.cc2
2 files changed, 3 insertions, 3 deletions
diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index ff3b763..e75b046 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -1434,7 +1434,7 @@ afdo_calculate_branch_prob (bb_set *annotated_bb)
else
total_count += AFDO_EINFO (e)->get_count ();
}
- if (num_unknown_succ == 0 && total_count > profile_count::zero ())
+ if (num_unknown_succ == 0 && total_count.nonzero_p())
{
FOR_EACH_EDGE (e, ei, bb->succs)
e->probability
@@ -1571,7 +1571,7 @@ afdo_annotate_cfg (const stmt_set &promoted_stmts)
DECL_SOURCE_LOCATION (current_function_decl));
afdo_source_profile->mark_annotated (cfun->function_start_locus);
afdo_source_profile->mark_annotated (cfun->function_end_locus);
- if (max_count > profile_count::zero ())
+ if (max_count.nonzero_p())
{
/* Calculate, propagate count and probability information on CFG. */
afdo_calculate_branch_prob (&annotated_bb);
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index 0964190..2608c28 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -3335,7 +3335,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
free (bbs);
free (original_bbs);
}
- else
+ else if (old_count.nonzero_p ())
scale_loop_profile (epilog, guard_to->count.probability_in (old_count), -1);
/* Only need to handle basic block before epilog loop if it's not