Using interprocedural analysis

Interprocedural analysis (IPA) enables the compiler to optimize across different files (whole-program analysis), and it can result in significant performance improvements.

You can specify interprocedural analysis on the compilation step only or on both compilation and link steps in whole program mode. Whole program mode expands the scope of optimization to an entire program unit, which can be an executable or a shared object. As IPA can significantly increase compilation time, you should limit using IPA to the final performance tuning stage of development.

You can enable IPA by specifying the -qipa option. The most commonly used suboptions and their effects are described in the following table. The full set of suboptions and syntax is described in -qipa .

The steps to use IPA are as follows:
  1. Do preliminary performance analysis and tuning before compiling with the -qipa option, because the IPA analysis uses a two-pass mechanism that increases compilation time and link time. You can reduce some compilation and link overhead by using the -qipa=noobject option.
  2. Specify the -qipa option on both the compilation and the link steps of the entire application, or as much of it as possible. Use suboptions to indicate assumptions to be made about parts of the program not compiled with -qipa.
Table 1. Commonly used -qipa suboptions
Suboption Behavior
level=0 Program partitioning and simple interprocedural optimization, which consists of:
  • Automatic recognition of standard libraries.
  • Localization of statically bound variables and procedures.
  • Partitioning and layout of procedures according to their calling relationships. (Procedures that call each other frequently are located closer together in memory.)
  • Expansion of scope for some optimizations, notably register allocation.
level=1 Inlining and global data mapping. Specifically:
  • Procedure inlining.
  • Partitioning and layout of static data according to reference affinity. (Data that is frequently referenced together will be located closer together in memory.)
This is the default level if you do not specify any suboptions with the -qipa option.
level=2 Global alias analysis, specialization, interprocedural data flow:
  • Whole-program alias analysis. This level includes the disambiguation of pointer dereferences and indirect function calls, and the refinement of information about the side effects of a function call.
  • Intensive intraprocedural optimizations. This can take the form of value numbering, code propagation and simplification, moving code into conditions or out of loops, and elimination of redundancy.
  • Interprocedural constant propagation, dead code elimination, pointer analysis, code motion across functions, and interprocedural strength reduction.
  • Procedure specialization (cloning).
  • Whole program data reorganization.
inline=suboptions Provides precise control over function inlining.
fine_tuning Other values for -qipa provide the ability to specify the behavior of library code, tune program partitioning, read commands from a file, and so on.
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 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 2. 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-01.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.



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