Interprocedural analysis (IPA)
Interprocedural Analysis (IPA) can analyze and optimize your application as a whole, rather than on a file-by-file basis.
Run during the link step of an application build, the entire application, including linked libraries, is available for interprocedural analysis. This whole program analysis opens your application to a powerful set of transformations available only when more than one file or compilation unit is accessible. IPA optimizations are also effective on mixed language applications.
The following are some of the link-time transformations that IPA can use to restructure and optimize your application:
- Inlining between compilation units.
- Complex data flow analyses across subprogram calls to eliminate parameters or propagate constants directly into called subprograms.
- Improving parameter usage analysis, or replacing external subprogram calls to system libraries with more efficient inline code.
- Restructuring data structures to maximize access locality.
- Cloning subprograms where calls pass constant parameters to allow optimizing expressions using those parameters.
In order to maximize IPA link-time optimization, you must use IPA at both the compile and link step. Objects you do not compile with IPA can only provide minimal information to the optimizer, and receive minimal benefit. However when IPA is active on the compile step, the resulting object file contains program information that IPA can read during the link step. The program information is invisible to the system linker, and you can still use the object file and link without invoking IPA. The IPA optimizations use hidden information to reconstruct the original compilation and can completely analyze the subprograms the object contains in the context of their actual usage in your application.
During the link step, IPA restructures your application, partitioning it into distinct logical code units. After IPA optimizations are complete, IPA applies the same low-level compilation-unit transformations as the -O2 and -O3 base optimizations levels. Following those transformations, the compiler creates one or more object files and linking occurs with the necessary libraries through the system linker.
It is important that you specify a set of compilation options as consistent as possible when compiling and linking your application. This includes all compiler options, not just -qipa suboptions. When possible, specify identical options on all compilations and repeat the same options on the IPA link step. Incompatible or conflicting options that you specify to create object files, or link-time options in conflict with compile-time options can reduce the effectiveness of IPA optimizations.
- XL C/C++ and XL Fortran provide backwards compatibility with IPA object files that are created by earlier compiler versions. If IPA object files that are compiled with newer versions of compilers are linked by an earlier version, errors occur during the link step. For example, if IPA object file a.o is compiled by XL C/C++ for Linux, V13.1.3 and is to be linked with IPA object file b.o that is compiled by XL Fortran for Linux, V15.1.0, then you must use a compiler whose version is XL C/C++ for Linux, V13.1.3 or later.
- XL C/C++ and XL Fortran versions released at the same time produce
matching IPA level information and can be linked together. For example,
the IPA level for XL C/C++ for Linux, V13.1.3 matches with the IPA for
XL Fortran for Linux,
V15.1.3. The following table lists some matching XL C/C++ and XL Fortran
releases:
Table 1. Compiler versions and release dates Compiler version General availability (Release date) XL C/C++ for Linux, V13.1.3
XL Fortran for Linux, V15.1.3
11-Dec-2015 XL C/C++ for Linux, V13.1.0
XL Fortran for Linux, V15.1.0
06-Jun-2014 XL C/C++ for Linux, V12.1.0
XL Fortran for Linux, V14.1.0
18-May-2012 For more information about the release dates of compiler products, see the Support Lifecycle website at http://www.ibm.com/software/support/lifecycle/index_x.html.
If your compiler version has two release dates on the Support Lifecycle web site, determine the date based on your product ID.
See the following topics for further information about IPA optimizations.