Profile-Guided Optimization (PGO) is an optimization technique where a performance profile is fed to the compiler to provide optimization information that is not directly evident from the source code, such as branching patterns which are the result of patterns in the input data, frequency of function calls, and number of iterations typically peformed of each loop. This information affects optimizations such as code relocation, inlining, and loop unrolling.
PGO involves these steps:
Both GCC and LLVM have PGO features. Note that the profiling options, instrumentation, and profile data is not the same as that used with other tools such as gprof.