IPO Compilation Model

For the topics in this section, the term IPO generally refers to multi-file IPO.

One of the main benefits of IPO is that it enables more inlining. For information on inlining and the minimum inlining criteria, see Criteria for Inline Function Expansion and Controlling Inline Expansion of User Functions. Inlining and other optimizations are improved by profile information. For a description of how to use IPO with profile information for further optimization, see Example of Profile-Guided Optimization.

When you use the -ipo (Linux*) or /Qipo (Windows*) option, the compiler collects information from individual program modules of a program. Using this information, the compiler performs optimizations across modules. In order to do this, the -ipo (Linux) or /Qipo (Windows) option is applied to both the compilation and the linkage phases.

Phase

Description

Compilation

When using IPO, as each source file is compiled, the compiler stores an intermediate representation (IR) of the source code in the object file, which includes summary information used for optimization.

By default, the compiler produces mock object files during the compilation phase of IPO. The mock object files contain the IR, instead of object code, so generating mock files instead of real object files reduces the time spent in the IPO compilation phase.

Each mock object file contains the IR for its corresponding source file, but no real code or data. These mock objects must be linked with the Intel® compiler or by using the Intel linkers: xild (Linux) or xilink (Windows). See Creating a Multifile IPO Executable.

Caution

Failure to link the mock objects with the Intel linkers will result in linkage errors.

Linkage

When you link with the -ipo (Linux) or /Qipo (Windows) option the compiler is invoked a final time. The compiler performs IPO across all object files that have an IR.

The compiler first analyzes all of the summary information, and then finishes compiling the pieces of the application for which it has IR. Having global information about the application while it is compiling individual pieces can improve optimization quality.

The -ipo (Linux) or /Qipo (Windows) option enables the driver and compiler to attempt detecting a whole program automatically. If a whole program is detected, the interprocedural constant propagation, stack frame alignment, data layout and padding of common blocks perform more efficiently, while more dead functions get deleted. This option is safe.