The command line options to enable IPO for compilations targeted for both the IA-32 and Itanium® architectures are identical. To produce mock object files containing intermediate representation (IR), compile your source files with -ipo as follows:
prompt>icpc -ipo -c a.cpp b.cpp c.cpp
This produces a.o, b.o, and c.o object files. These files contain Intel compiler IR corresponding to the compiled source files a.cpp, b.cpp, and c.cpp. Using -c to stop compilation after generating .o files is required.
You can now optimize interprocedurally by adding -ipo to your link command line. The following example produces an executable named app:
prompt>icpc -oapp -ipo a.o b.o c.o
This command invokes the compiler on the objects containing IR and creates a new list of object(s) to be linked. The command then calls GCC ld to link the specified object files and produce app, as specified by the -o option. IPO is applied only to the object files that contain IR; otherwise the object file passes to link stage.
For the above step, you can use the xild tool instead of icpc.
The two steps described above can be combined, as shown in the following:
prompt>icpc -ipo -oapp a.f b.f c.f