GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ipa-cp Performance Win

ipa-cp: Adjust PGO IPA-CP cloning heuristics

Refines GCC's PGO-based IPA-CP cloning heuristics by scaling run-time metrics.

GCC’s inter-procedural analysis (IPA) cloning pass, when used with Profile-Guided Optimization (PGO), now correctly scales the run-time metrics used for evaluating cloning opportunities. This adjustment ensures that these metrics are relative to the total program run time, aligning PGO-driven scores more closely with those derived from guessed profiles.

In Details

The IPA-CP pass's good_cloning_opportunity_p function previously failed to scale PGO run-time evaluations by the total measured run time of the compilation unit. This commit introduces overall_scaled_runtime to perform this scaling, making the opportunity scores more accurately reflect the cost/benefit of cloning based on actual profiled execution. A new parameter ipa-cp-profile-runtime-scaling is introduced to control this scaling factor, allowing it to be tuned to match existing heuristic score ranges.

For Context
IPA-CP
Inter-procedural Analysis - Cloning Pass. A GCC optimization pass that analyzes code across function boundaries to identify opportunities for code cloning, which can enable further optimizations.
PGO
Profile-Guided Optimization. A compilation technique where the compiler uses runtime execution profiles collected from instrumented runs of the program to make more informed optimization decisions.
cloning heuristics
Rules or criteria used by the compiler to decide whether to duplicate (clone) code sections for optimization purposes. These heuristics balance the potential benefits of cloning against its costs.
compilation unit
A single source file that is compiled by the compiler. It can include multiple source files if they are combined before compilation.
Filed Under: optimizationipapgo