The options used for basic PGO optimizations are:
-prof_gen[x] for generating instrumented code
-prof_use for generating a profile-optimized executable
In cases where your code behavior differs greatly between executions, you have to ensure that the benefit of the profile information is worth the effort required to maintain up-to-date profiles. In the basic profile-guided optimization, the following options are used in the phases of the PGO:
The -prof_gen[x] option instruments the program for profiling: to get the execution count of each basic block. Used in phase 1 of the PGO to instruct the compiler to produce instrumented code in your object files in preparation for instrumented execution. With x qualifier, -prof_genx, gathers extra information for use with the Proforder tool.
The -prof_use option is used in phase 3 of the PGO to instruct the compiler to produce a profile-optimized executable and merges available dynamic-information (.dyn) files into a pgopti.dpi file.
The dynamic-information files are produced in phase 2 when you run the instrumented executable.
If you perform multiple executions of the instrumented program, -prof_use merges the dynamic-information files again and overwrites the previous pgopti.dpi file.
Note
For Itanium(TM)-based applications, if you intend to use the -prof_use
option with optimizations at the -O3
level, the -O3 option must be on. If you intend
to use the -prof_use option with optimizations
at the -O2 level or lower, you can generate the
profile data with the default options.