Rate This Document
Findability
Accuracy
Completeness
Readability

Feature Description

The current profile-guided optimization (PGO) profile is not context-sensitive. The branch probabilities of inline functions remain the same for all callers, but the actual probabilities vary greatly in different calling contexts. Such suboptimal profiles significantly impact the effects of multiple downstream optimizations, especially basic block layout and register allocation at the machine level.

To address this issue, the context-sensitive PGO (CSPGO) introduces a post-inline profiling process to collect runtime profiles after inline expansion, implementing context-sensitive feedback information, that is, context-sensitive PGO.

Therefore, two profiles are generated during the optimization process:

  • The original PGO profile is used to guide early optimization, such as function inlining and indirect call promotion.
  • The CSPGO profile is used for post-inline optimizations such as basic block rearrangement and register allocation to obtain more accurate performance gains.