https://gcc.gnu.org/g:f40ee73f6e7d50608d7a464e57ce2000ae5d0014

commit r17-5009-gf40ee73f6e7d50608d7a464e57ce2000ae5d0014
Author: Kugan Vivekanandarajah <[email protected]>
Date:   Fri Oct 9 11:02:22 2026 +1100

    [AutoFDO] Keep a local IPA-CP profile under -fprofile-partial-training
    
    When the callers of a new clone already claim more count than the original
    node, update_profiling_info lowers the original's profile.  The comment
    says to lower it to global0adjusted, or to local under partial training,
    but both branches ran: make_profile_local was immediately overwritten by
    make_profile_global0.
    
    gcc/ChangeLog:
    
            * ipa-cp.cc (update_profiling_info): Under
            -fprofile-partial-training lower the original node's profile to
            local instead of also forcing it to global0.

Diff:
---
 gcc/ipa-cp.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index cecc8d17f17c..b35e07a49d4a 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -4845,7 +4845,7 @@ update_profiling_info (struct cgraph_node *orig_node,
         to global0adjusted or to local if we have partial training.  */
       if (opt_for_fn (orig_node->decl, flag_profile_partial_training))
        orig_node->make_profile_local ();
-      if (new_sum.quality () == AFDO)
+      else if (new_sum.quality () == AFDO)
        orig_node->make_profile_global0 (GUESSED_GLOBAL0_AFDO);
       else
        orig_node->make_profile_global0 (GUESSED_GLOBAL0_ADJUSTED);

Reply via email to