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.

Figure 1. IPA at the link step
IPA at the link step

The following are some of the link-time transformations that IPA can use to restructure and optimize your application:

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.

Notes:
  • XL C/C++ and XL Fortran provide backwards compatibility with IPA objects 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++, V13.1.3 and is to be linked with IPA object file b.o that is compiled by XL Fortran, V15.1.0, then you must use a compiler whose version is XL C/C++, 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 for XL C/C++, V13.1.3 matches with the IPA for XL Fortran, V15.1.3, because these compilers are released at the same time. For example, the IPA level for XL C/C++, V13.1.3 matches with the IPA for XL Fortran, V15.1.3. The following table lists some matching XL C/C++ and XL Fortran releases:
    Table 1. Compiler versions and release date
    Compiler version General availability (Release date)

    XL C for AIX®, V13.1.3

    XL C/C++ for AIX, V13.1.3

    XL Fortran for AIX, V15.1.3

    11-Dec-2015

    XL C for AIX, V13.1.0

    XL C/C++ for AIX, V13.1.0

    XL Fortran for AIX, V15.1.0

    06-Jun-2014

    XL C for AIX, V12.1.0

    XL C/C++ for AIX, V12.1.0

    XL Fortran for AIX, V14.1.0

    18-May-2012

    For more information about the release dates of compiler products, see 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.



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us