Feature Description
This optimization collects program runtime information (profiles) through instrumentation to support optimization decisions. The compiler guides various optimizations based on the profiles to generate more efficient target programs.
This optimization primarily encompasses two optimization methods:
- Edge Profile: Counters are inserted along the edges of the control flow graph (CFG) of the function to collect program execution count information.
- Value Profile: The compiler optimization inserts code during instrumentation to gather statistics on commonly-used values of expressions and variables, providing the compiler with insights for better optimization decisions. After program execution, the profile is read back by the compiler to guide the compiler to make a better optimization decision. GCC currently supports various value profile counting functionalities, including frequently used variable values, identification of powers of two, high-frequency indirect call addresses, and function first run IDs.
Parent topic: PGO