]> gcc.gnu.org Git - gcc.git/commitdiff
Fix profile count comparison.
authorEugene Rozenfeld <erozen@microsoft.com>
Fri, 23 Sep 2022 01:12:01 +0000 (18:12 -0700)
committerEugene Rozenfeld <erozen@microsoft.com>
Tue, 27 Sep 2022 23:46:42 +0000 (16:46 -0700)
The comparison was incorrect when the counts weren't PRECISE.
For example, crossmodule-indir-call-topn-1.c was failing
with AutoFDO: when count_sum is 0 with quality AFDO,
count_sum > profile_count::zero() evaluates to true. Taking that
branch then leads to an assert in the call to to_sreal().

Tested on x86_64-pc-linux-gnu.

gcc/ChangeLog:

* ipa-cp.cc (good_cloning_opportunity_p): Fix profile count comparison.

gcc/ipa-cp.cc

index 543a9334e2c1ffab4c8cb374f7de02e3bd979cd7..66bba71c06848e6bce832ca5535e4da585acd47a 100644 (file)
@@ -3338,9 +3338,9 @@ good_cloning_opportunity_p (struct cgraph_node *node, sreal time_benefit,
 
   ipa_node_params *info = ipa_node_params_sum->get (node);
   int eval_threshold = opt_for_fn (node->decl, param_ipa_cp_eval_threshold);
-  if (count_sum > profile_count::zero ())
+  if (count_sum.nonzero_p ())
     {
-      gcc_assert (base_count > profile_count::zero ());
+      gcc_assert (base_count.nonzero_p ());
       sreal factor = count_sum.probability_in (base_count).to_sreal ();
       sreal evaluation = (time_benefit * factor) / size_cost;
       evaluation = incorporate_penalties (node, info, evaluation);
This page took 0.060909 seconds and 5 git commands to generate.