IPA: Apply computed profile scaling to call graphs
Fixes stale call graph edge counts after profile redistribution, preventing LTO ICEs.
The Inter-procedural Analysis (IPA) pass failed to apply computed profile scaling factors to call graph edges. This resulted in stale counts after clone redistribution and verification failures, triggering an internal compiler error (ICE) during AutoFDO LTO compilation. This commit corrects cgraph_node::scale_profile_to to apply the computed scale, ensuring accurate profile data for subsequent optimization passes.
In Details
In GCC's Inter-procedural Analysis (IPA) framework, specifically within the cgraph representation, cgraph_node::scale_profile_to computes a scaling factor to adjust call edge profiles after operations like cloning or redistribution. Previously, this computed scale was not applied, leaving call_stmt_counts stale. This commit fixes scale_profile_to to actually apply the calculated scale, resolving verification failures (verify_cgraph_node) that occurred during LTO compilation, particularly when AutoFDO profile data is involved.
- IPA
- Inter-procedural Analysis, a compiler optimization technique that analyzes code across function boundaries.
- cgraph
- GCC's internal representation for call graphs, modeling functions as nodes and calls as edges.
- AutoFDO
- Automatic Feedback-Directed Optimization, a technique that uses runtime profile data collected by tools like a profiler to guide compiler optimizations.
- LTO
- Link-Time Optimization, a compilation strategy where optimization is performed at link time, allowing analysis across multiple translation units.
- ICE
- Internal Compiler Error, a serious error encountered during compilation that halts the process.
- clone redistribution
- A process in IPA where cloned functions are redistributed, potentially requiring call counts to be updated.