[gcc r17-3484] [IPA] Apply computed profile scaling

Kugan Vivekanandarajah via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:89f8552e424c431cbd02f21f133a1c6c60a5c983

commit r17-3484-g89f8552e424c431cbd02f21f133a1c6c60a5c983
Author: Kugan Vivekanandarajah <[email protected]>
Date:   Fri Aug 21 11:07:22 2026 +1000

    [IPA] Apply computed profile scaling
    
    cgraph_node::scale_profile_to computed an adjusted scale but never
    applied it, leaving callgraph edges stale after IPA-CP clone
    redistribution and causing edge/BB count verification failures.
    
    The stale counts triggered this ICE during AutoFDO LTO compilation:
    
      internal compiler error: verify_cgraph_node failed
      #0  internal_error(char const*, ...)
          .../gcc/diagnostic-global-context.cc:787
      #1  cgraph_node::verify_node()
          .../gcc/cgraph.cc:4510
      #2  symtab_node::verify()
          .../gcc/symtab.cc:1377
      #3  optimize_inline_calls(tree_node*)
          .../gcc/tree-inline.cc:5679
      #4  inline_transform(cgraph_node*)
          .../gcc/ipa-inline-transform.cc:871
      #5  execute_one_ipa_transform_pass
          .../gcc/passes.cc:2327
      #6  execute_all_ipa_transforms(bool)
          .../gcc/passes.cc:2390
      #7  cgraph_node::expand()
          .../gcc/cgraphunit.cc:1867
      #8  cgraph_node::expand()
          .../gcc/cgraphunit.cc:1827
      #9  expand_all_functions
          .../gcc/cgraphunit.cc:2057
      #10 symbol_table::compile()
          .../gcc/cgraphunit.cc:2435
      #11 lto_main()
          .../gcc/lto/lto.cc:718
    
    gcc/ChangeLog:
    
            * cgraph.cc (cgraph_node::scale_profile_to): Apply the computed scale.

Diff:
---
 gcc/cgraph.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index cdb3201f49ce..404bc222d18a 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -314,6 +314,7 @@ cgraph_node::scale_profile_to (profile_count ipa_count)
   profile_count num = count.combine_with_ipa_count (ipa_count);
   profile_count den = count;
   profile_count::adjust_for_ipa_scaling (&num, &den);
+  apply_scale (num, den);
 }
 
 /* Insert a new cgraph_function_version_info node into cgraph_fnver_htab
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.