For a routine to be considered for inlining, it has to meet certain minimum criteria. There are criteria to be met by the call-site, the caller, and the callee.
The call-site is the site of the call to the function that might be inlined.
The caller is the function that contains the call-site.
The callee is the function being called that might be inlined.
The number of actual arguments must match the number of formal arguments of the callee.
The number of return values must be the same as the callees' number.
The data types of the actual and formal arguments must be compatible.
No multi-lingual inlining is allowed. Caller and callee must be written in the same source language.
At most, 2000 intermediate statements will be inlined into the caller from all the call-sites being inlined to the caller. You can change this value by specifying the option -Qoption,c,-ip_ninl_max_total_stats=new value
The function must be called or have its address used if it is declared as static. Otherwise, it will be deleted.
Routines that contain the following substrings
in their names are not inlined: abort, alloca, denied, err, exit, fail,
fatal, fault, halt, init, interrupt, invalid, quit, rare, stop, timeout,
trace, trap, and warn.
Once these criteria are met, the compiler picks the routines whose
inline expansions provide the greatest benefit to program performance.
This is done using the following default heuristics. When you use profile-guided
optimizations, a number of other heuristics are used.
The default heuristic focuses on call-sites in loops or calls to functions containing loops.
When profile information is available, the focus changes to the most frequently executed call-sites. Also, the default inline heuristic does not allow the inlining of functions with more than 230 intermediate statements, or the number specified by the option -Qoption,c,-ip_ninl_max_stats.
The default inline heuristic stops when it detects direct recursion.
The default heuristic will always inline very small functions that meet the minimum inline criteria. By default, functions with 15 or fewer intermediate statements are inlined. This limit can be modified with the option -Qoption,c,-ip_ninl_min_stats.