GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ipa-cp

Adjusts IPA-CP cloning heuristics to reduce code size.

Adjusts interprocedural constant propagation (IPA-CP) cloning heuristics to reduce excessive code growth by increasing the cost/benefit threshold.

Interprocedural constant propagation (IPA-CP) was cloning too aggressively, leading to excessive code growth. This commit adjusts the cloning heuristics by raising the cost/benefit threshold (param_ipa_cp_eval_threshold) from 500 to 1100. It also reverts a change to get_max_overall_size that caused the size limit to depend on the current call-graph sweep, as this was counteracting the intended gradual reduction of the threshold.

In Details

IPA-CP aims to propagate constant values across function boundaries, enabling further optimizations. Cloning is a technique used to create specialized versions of functions based on the propagated constants. param_ipa_cp_eval_threshold controls the cost/benefit trade-off of cloning. By increasing this threshold, the compiler becomes more selective about which functions to clone. The change to get_max_overall_size was intended to limit code growth, but it inadvertently interfered with the evaluation threshold.

For Context

Interprocedural optimization (IPA) is a compiler optimization technique that analyzes and optimizes code across multiple functions. Constant propagation is a specific optimization that replaces variables with their constant values when those values are known at compile time. Function cloning creates specialized copies of functions, allowing the compiler to optimize each copy based on the specific context in which it is called. This commit adjusts the heuristics that determine when to clone functions during IPA to reduce code size. By cloning functions less aggressively, the compiler can reduce the overall size of the compiled program.

Filed Under: optimizationipaconstant propagationcode size