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. Fixing it.

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.

Signed-off-by: Kugan Vivekanandarajah <[email protected]>
---
 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 d0428d04684..829d9ab6361 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -4815,7 +4815,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);
-- 
2.34.1

Reply via email to