Criteria for Inline Function Expansion
Once the criteria are met, the compiler picks the routines whose inline
expansion will provide the greatest benefit to program performance. The
inlining heuristics used by the compiler differ, based on whether or not
you use profile-guided optimizations (-prof_use).
When you use profile-guided optimizations with -ip
or -ipo, the compiler uses the following heuristics:
- The default heuristic focuses on the most frequently
executed call sites, based on the profile information gathered for the
program.
- By default, the compiler will not inline functions
with more than 230 intermediate statements. You
can change this value by specifying the option -Qoption,c,-ip_ninl_max_stats=new_value.
Note: there
is a higher limit for functions declared by the user as inline
or __inline.
- The default inline heuristic will stop inlining when
direct recursion is detected.
- The default heuristic will always inline very small
functions that meet the minimum inline criteria.
- Default for ItaniumŪ-based applications: ip_ninl_min_stats=15.
- Default for IA-32 applications: ip_ninl_min_stats=7.
This limit can be modified with the option -Qoption,c,-ip_ninl_min_stats=new_value.
If you do not use profile-guided optimizations with -ip
or -ipo, the compiler uses less aggressive inlining
heuristics:
- Inline a function if the inline expansion will not
increase the size of the final program.
- Inline a function if it is declared with the inline or __inline keywords.