https://gcc.gnu.org/g:40d9e9601a1122749b21b98b4c88029b2402ecfc

commit r16-4106-g40d9e9601a1122749b21b98b4c88029b2402ecfc
Author: Jan Hubicka <[email protected]>
Date:   Fri Sep 26 15:57:03 2025 +0200

    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)
    
    gcc/ChangeLog:
    
            * auto-profile.cc (afdo_propagate_edge): Fix handling of precize 0
            counts.

Diff:
---
 gcc/auto-profile.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index 7d867de5bd9d..e71689de3086 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -3181,6 +3181,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