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:
ifx -ipo -c a.f90 b.f90 c.f90
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:
ifx -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:
ifx -ipo -o app a.f90 b.f90 c.f90
The ifx command, shown in the examples, calls GCC ld to link the specified object files and produce the executable application, which is specified by the -o option.
Windows
Compile your source files with the /Qipo compiler option:
ifx /Qipo /c a.f90 b.f90 c.f90
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:
ifx /Qipo /exe:app 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:
ifx /Qipo /exe:app a.f90 b.f90 c.f90
The ifx command, shown in the examples, calls link.exe to link the specified object files and produce the executable application, which is specified by the /exe option.
Capture Intermediate IPO Output
The [Q]ipo-c and [Q]ipo-S compiler options are useful for analyzing the effects of multi-file IPO, or when experimenting with multi-file IPO between modules that do not make up a complete program.
Use the [Q]ipo-c compiler option to optimize across files and produce an object file. The option performs optimizations as described for the [Q]ipo option but stops prior to the final link stage, leaving an optimized object file. The default name for this file is ipo_out.o (Linux) or ipo_out.obj (Windows).
Use the [Q]ipo-S compiler option to optimize across files and produce an assembly file. The option performs optimizations as described for [Q]ipo, but stops prior to the final link stage, leaving an optimized assembly file. The default name for this file is ipo_out.s (Linux) or ipo_out.asm (Windows).
For both options, you can use the -o (Linux) or /exe (Windows) option to specify a different name.
These options generate multiple outputs if multi-object IPO is being used. The name of the first file is taken from the value of the -o (Linux) or /exe (Windows) option.
The names of subsequent files are derived from the first file with an appended numeric value to the file name. For example, if the first object file is named foo.o (Linux) or foo.obj (Windows), the second object file will be named foo1.o or foo1.obj.
You can use the object file generated with the [Q]ipo-c option, but you will not get the full benefit of whole program optimizations if you use this option.
The object file created using the [Q]ipo-c option is a real object file, in contrast to the mock file normally generated using IPO; however, the generated object file is significantly different than the mock object file. Whole program optimizations, which require a knowledge of how the real object file will be linked in with other files to produce and object, are not applied.
The compiler generates a message indicating the name of each object or assembly file it generates. These files can be added to the real link step to build the final application.