Use Interprocedural Optimization
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.
Linux*
- Compile your source files with theipocompiler option:icpx -ipo -c a.cpp b.cpp c.cppThe command producesa.o,b.o, andc.oobject files.Use theccompiler option to stop compilation after generating object files. The output files contain compiler intermediate representation (IR) corresponding to the compiled source files.
- Link the resulting files. The following example command will produce an executable namedapp:icpx -o app a.o b.o c.oThe command invokes the compiler on the objects containing IR and creates a new list of objects to be linked. Alternately, you can use the tool, with the appropriate linking options.
The separate compile and link commands from the previous steps can be combined into a single command, for example:
icpx -ipo -o app a.cpp b.cpp c.cpp
The
icx/icpx (for C++) or dpcpp (for DPC++)
command, shown in the examples, calls
GCC ld
to link the specified object files and produce the executable application, which is specified by the
option.
Windows*
- Compile your source files with the/Qipocompiler option:icx /Qipo /c a.cpp b.cpp c.cppThe command producesa.obj,b.obj, andc.objobject files.Use theccompiler option to stop compilation after generating.objfiles. The output files contain compiler intermediate representation (IR) corresponding to the compiled source files.
- Link the resulting files. The following example command will produce an executable namedapp:icx /Feapp a.obj b.obj c.objThe command invokes the compiler on the objects containing IR and creates a new list of objects to be linked. Alternately, you can use thexilinktool, with the appropriate linking options.
The separate compile and link commands from the previous steps can be combined into a single command, for example:
icx /Qipo /Feapp a.cpp b.cpp c.cpp
The
icx/icpx (for C++) or dpcpp (for DPC++)
command, shown in the examples, calls
link.exe
to link the specified object files and produce the executable application, which is specified by the
/Fe
option.
Linux: Using
icpx (for C++) or dpcpp (for DPC++)
allows the compiler to use standard C++ libraries automatically; icx 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.