Visible to Intel only — GUID: GUID-BAC44C7F-5A85-45D7-9595-F2AA2595F399
Visible to Intel only — GUID: GUID-BAC44C7F-5A85-45D7-9595-F2AA2595F399
Use Interprocedural Optimization
This topic discusses how to use IPO from the command line.
Compile and Link Using IPO
To enable IPO, you first compile each source file, then link the resulting source files.
Linux
Compile your source files with the ipo compiler option:
icpx -ipo -c a.cpp b.cpp c.cpp
The command produces a.o, b.o, and c.o object files.
Use the c compiler 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 named app:
icpx -ipo -o app a.o b.o c.o
The command invokes the compiler on the objects containing IR and creates a new list of objects to be linked.
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 icpx 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 /Qipo compiler option:
icx /Qipo /c a.cpp b.cpp c.cpp
The command produces 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.
Link the resulting files. The following example command will produce an executable named app:
icx /Qipo /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.
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 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 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.
Starting with version 2024.0, options specified with the Clang -mllvm flag are no longer passed through to linker option processing. Instead, use the -Wl option to pass options to the linker. For example, to pass the -lto-debug-options option to the linker, use:
-Wl,-plugin-opt,-lto-debug-options