Fix precise 0 handling in afdo_propagate_edge

Currently afdo_propagate_edge will turn precise 0 to autofdo 0 because it thinks
auto-profile claims some samples has been executed in the given basic block, 
while
this is only a consequence of < being defined by
 0 (predise) < 0 (autofdo)

Bootstrapped/regtested x86_64-linux, comitted.

gcc/ChangeLog:

        * auto-profile.cc (afdo_propagate_edge): Fix handling of precize 0
        counts.

diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index 7d867de5bd9..3af2c602cbe 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -3181,6 +3279,8 @@ afdo_propagate_edge (bool is_succ, bb_set *annotated_bb)
        changed = true;
       }
     else if (is_bb_annotated (bb, *annotated_bb)
+            /* We do not want to consider 0 (afdo) > 0 (precise)  */
+            && total_known_count.nonzero_p ()
             && bb->count < total_known_count)
       {
        if (dump_file)

Reply via email to