Interprocedural Analysis (IPA) Optimization Options

Interprocedural analysis includes a set of compiler techniques that examine an entire program, as opposed to a single block of code, to increase the opportunity for optimization, particularly when a program uses many, frequently called functions.

Interprocedural analysis includes a set of compiler techniques that examine an entire program, as opposed to a single block of code, to increase the opportunity for optimization, particularly when a program uses many, frequently called functions.

Inlining and cloning transform code in ways that increase the opportunity for interprocedural (IPA) optimizations. The user controls inlining and cloning through the use of command line options alone or command line options in combination with directives placed within the code. By default, the compiler will attempt inline optimizations where appropriate, but not cloning. Inlining and cloning may increase object code size.

Inlining/Cloning

The compiler supports the following inlining modes through the indicated options:
  • Automatic inlining/cloning allows the compiler to automatically select which functions to optimize. This occurs with the -h ipa2 or greater option. When -h ipa is used alone, the candidates for expansion are all those functions that are present in the input file to the compile step.
  • Explicit inlining/cloning allows for the explicit indication of which procedures the compiler should attempt to optimize and occurs with the -h ipafrom= option.
  • Combined inlining/cloning allows potential targets to be specified, while applying the selected level of heuristics. If -h ipa is used in conjunction with -h ipafrom= the candidates for expansion are those functions present in source. -h ipa selects level of heuristics.

-h ipa level

Default: -h ipa3

Specifies the level of interprocedural optimization (IPA). level may be one of the following values, and includes functionality of previous non-zero levels:
0
Disable interprocedural analysis and optimizations. All inlining and cloning compiler directives are ignored.
1
Directive IPA. Inlining/cloning is attempted for call sites and routines that are under the control of a compiler directive. See Inline and Clone Directives.
2
No automatic cloning will occur at this setting; only inlining. Inline a call site to an arbitrary depth as long as the expansion does not exceed some compiler determined threshold. The call site must flatten for any expansion to occur. The call site is said to "flatten" when there are no calls present in the expanded code. The call site must reside within the body of a loop and the entire loop body must flatten. A loop body is said to "flatten" when all call sites within the body of the loop are flattened.
3
This is the default level for IPA. Automatic inlining/cloning will occur at this setting. A call site must flatten for any inlining to occur. Inline any call site that contains a constant actual argument. Inline any call nest (regardless of location) that is below some small compiler-determined threshold. If inlining fails at a given call site and IPA analysis determines that there is the potential for execution performance improvement, the compiler may clone the call site.
4
This is a more aggressive level of IPA. A call site does not have to reside in a loop body to inline. Nor does the call site have to necessarily flatten. Nor does a loop body necessarily have to flatten. With -h ipa4, C++ codes will likely see improved execution performance. However, compile time may also increase.
5
This is the most aggressive level of IPA. This level can lead to very long compile times.

-h ipafrom=source[:source] ...

Explicitly indicate the procedures to consider for inline expansion or cloning. The source arguments identify each file or directory that contains the routines to consider for inlining or cloning. Spaces are not allowed on either side of the equal sign.

Use one or more of the following in the source argument:
  • C or C++ sourcefiles with extension: .C, .c++, .C++, .cc, .cxx, .Cxx, . CXX, or .CC
  • Directory containing filetypes mentioned above