In addition to the options that support compiler directed inline expansion of user functions, the compiler also provides compiler options and pragmas that allow you to more precisely direct when and if inline function expansion should occur.

The compiler measures the relative size of a routine in an abstract value of intermediate language units, which is approximately equivalent to the number of instructions that will be generated. The compiler uses the intermediate language unit estimates to classify routines and functions as relatively small, medium, or large functions. The compiler then uses the estimates to determine when to inline a function; if the minimum criteria for inlining is met and all other things are equal, the compiler has an affinity for inlining relatively small functions and not inlining relative large functions.

Typically, the compiler targets functions that have been marked for inlining based on the following:

  • Inlining keywords: indicates to the compiler to inline the specified function. For example, __inline, __forceinline.
  • Procedure-specific inlining pragmas: indicates to the compiler to inline calls within the targeted procedure if it is legal to do so. For example,#pragma inline or #pragma forceinline .
  • GCC function attributes for inlining: indicates to the compiler to inline the function even when no optimization level is specified. For example, __attribute__((always_inline)).

The following developer directed inlining options and pragmas provide the ability to change the boundaries used by the inliner to distinguish between small and large functions.

In general, you should use the [Q]inline-factor option before using the individual inlining options listed below; this single option effectively controls several other upper-limit options.

If your code hits an inlining limit, the compiler issues a warning at the highest warning level. The warning specifies which of the inlining limits have been hit, and the compiler option and/or pragmas needed to get a full report. For example, you could get a message as follows:

Inlining inhibited by limit max-total-size.  Use -qopt-report -qopt-report-phase=ipo for full report.

Messages in the report refer directly to the command line options or pragmas that can be used to overcome the limits.

The following table lists the options you can use to fine-tune inline expansion of functions. The pragmas associated with the options are documented in the Effect column.

Option Effect


Controls the multiplier applied to all inlining options that define upper limits: inline-max-size, inline-max-total-size, inline-max-per-routine, and inline-max-per-compile. While you can specify an individual increase in any of the upper-limit options, this single option provides an efficient means of controlling all of the upper-limit options with a single command.

By default, this option uses a multiplier of 100, which corresponds to a factor of 1. Specifying 200 implies a factor of 2, and so on. Experiment with the multiplier carefully. You could increase the upper limits to allow too much inlining, which might result in your system running out of memory.


Instructs the compiler to force inlining of functions suggested for inlining whenever the compiler is capable doing so.

Without this option, the compiler treats functions declared with the __inline keyword as merely being recommended for inlining. When this option is used, it is as if they were declared with the __forceinline keyword.


Redefines the maximum size of small routines; routines that are equal to or smaller than the value specified are more likely to be inlined.


Redefines the minimum size of large routines; routines that are equal to or larger than the value specified are less likely to be inlined.


Limits the expanded size of inlined functions.

You can also use #pragma optimization_parameter inline-max-total-size=N to control the size an individual routine can grow through inlining.


Limits the number of times inlining can be applied within a routine.

You can also use #pragma optimization_parameter inline-max-per-routine to control the number of times inlining may be applied to a routine.


Limits the number of times inlining can be applied within a compilation unit.

The compilation unit limit depends on the whether or not you specify the [Q]ipo compiler option. If you enable IPO, all source files that are part of the compilation are considered one compilation unit. For compilations not involving IPO each source file is considered an individual compilation unit.