Developer Guide and Reference

Contents

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*
icpx
-ipo -c a.cpp b.cpp c.cpp
Windows*
icx
/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
icpx
-o app a.o b.o c.o
Windows
icx
/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
icpx
-ipo -o app a.cpp b.cpp c.cpp
Windows
icx
/Qipo /Feapp a.cpp b.cpp c.cpp
The
icx/icpx (for C++) or dpcpp (for DPC++)
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.
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.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.