Using IPO

This topic discusses how to use IPO from the command line.

Compiling and Linking Using IPO

To enable IPO, you first compile each source file, then link the resulting source files.

First, compile your source files with [Q]ipo compiler as shown below:

Operating System

Example Command

Linux*

icpc -ipo -c a.cpp b.cpp c.cpp

Windows*

icl /Qipo /c a.cpp b.cpp c.cpp

The output of the above example command differs according to operating system:

  • Linux: The commands produce a.o, b.o, and c.o object files.

  • Windows: The commands produce a.obj, b.obj, and c.obj object files.

Use the c compiler option to stop compilation after generating .obj files. The output files contain compiler intermediate representation (IR) corresponding to the compiled source files.

Second, link the resulting files. The following example command will produce an executable named app:

Operating System

Example Command

Linux

icpc -o app a.o b.o c.o

Windows

icl /Feapp a.obj b.obj c.obj

The command invokes the compiler on the objects containing IR and creates a new list of objects to be linked. Alternately, you can use the xilink (Windows) tool, with the appropriate linking options.

Combining the Steps

The separate compile and link commands demonstrated above can be combined into a single command, as shown in the following examples:

Operating System

Example Command

Linux

icpc -ipo -o app a.cpp b.cpp c.cpp

Windows

icl /Qipo /Feapp a.cpp b.cpp c.cpp

The icl/icpc command, shown in the examples above, calls GCC ld (Linux) or link.exe (Windows only) to link the specified object files and produce the executable application, which is specified by the /Fe (Windows) option.

Note

Linux: Using icpc allows the compiler to use standard C++ libraries automatically; icc will not use the standard C++ libraries automatically.

The Intel linking tools emulate the behavior of compiling at -O0 (Linux) and /Od (Windows) option.

If multiple file IPO is applied to a series of object files, no one which are mock object files, no multi-file IPO is performed. The object files are simply linked with the linker.

See Also

Para obtener información más completa sobre las optimizaciones del compilador, consulte nuestro Aviso de optimización.