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.



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