Interprocedural Analysis (-qipa)

Interprocedural analysis (IPA) enables the compiler to optimize across different files (whole-program analysis), and can result in significant performance improvements. Interprocedural analysis can be specified on the compile step only, or on both compile and link steps (whole program mode). Whole program mode expands the scope of optimization to an entire program unit, which can be an executable or shared object. Whole program IPA analysis can consume significant amounts of memory and time when compiling or linking large programs.

IPA is enabled by the -qipa option. A summary of the effects of the most commonly used suboptions follows.

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, which is also referred to as their call affinity. (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 when -qipa is specified.

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, code motion into conditions or out of loops, elimination of redundancy.
  • Interprocedural constant propagation, dead code elimination, pointer analysis.
  • Procedure specialization (cloning).
inline=inline-options Provides precise user control of inlining.
fine_tuning Other values for -qipa= provide the ability to specify the behavior of library code, tune program partioning, read commands from a file, and so on.

Getting the Most from -qipa

It is not necessary to compile everything with -qipa, but try to apply it to as much of your program as possible. Here are some suggestions.

Related Information:
IBM Copyright 2003