GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/ipa

Keep local IPA-CP profile under partial training

Ensures local profiles are maintained during partial training in AutoFDO.

This commit corrects the behavior of AutoFDO’s partial training mode. When a new clone of a function is created, and its call count exceeds the original, the original’s profile should be lowered. Previously, under partial training, the original’s profile was incorrectly forced to a global setting even when a local profile was intended. This change ensures that when -fprofile-partial-training is used, the original node’s profile is correctly set to local, preserving intended profiling information.

In Details

In update_profiling_info, when a new clone's count exceeds the original's, the original's profile count is lowered. The comment indicates it should be lowered to global0adjusted or local under -fprofile-partial-training. However, both branches were executed, leading to make_profile_local being immediately overwritten by make_profile_global0. This commit ensures that under -fprofile-partial-training, the original node's profile is lowered to local and not further forced to global0.

For Context
IPA-CP
Interprocedural Analysis - Code Prediction. A GCC optimization phase that uses profile information to make predictions about code execution.
AutoFDO
Automatic Feedback-Driven Optimization. A technique that uses runtime profiling data to guide compiler optimizations.
partial training
A mode of profile-guided optimization where only a subset of program execution paths are profiled, allowing for more targeted optimization.
profile
Data collected during program execution that indicates which parts of the code are executed frequently.
Filed Under: optimizationAutoFDOprofiling