When optimizing with the --opt_level=3 option (aliased as -O3), the compiler automatically inlines small functions. A command-line option, --auto_inline=size, specifies the size threshold. Any function larger than the size threshold is not automatically inlined. You can use the --auto_inline=size option in the following ways:
- If you set the size parameter to 0 (--auto_inline=0), automatic inline expansion is disabled.
- If you set the size parameter to a nonzero integer, the compiler uses this size threshold as a limit to the size of the functions it automatically inlines. The compiler multiplies the number of times the function is inlined (plus 1 if the function is externally visible and its declaration cannot be safely removed) by the size of the function.
The compiler inlines the function only if the result is less than the size parameter. The compiler measures the size of a function in arbitrary units; however, the optimizer information file (created with the --gen_opt_level=1 or --gen_opt_level=2 option) reports the size of each function in the same units that the --auto_inline option uses.
The --auto_inline=size option controls only the inlining of functions that are not explicitly declared as inline. If you do not use the --auto_inline=size option, the compiler inlines very small functions.
For information about interactions between command-line options, pragmas, and keywords that affect inlining, see Section 3.12.
Note: Optimization Level 3 and Inlining: In order to turn
on automatic inlining, you must use the --opt_level=3 option. If you desire the --opt_level=3 optimizations, but not automatic
inlining, use --auto_inline=0 with the --opt_level=3 option.
Note:
Inlining and Code Size: Expanding functions inline increases code size,
especially inlining a function that is called in a number of places. Function
inlining is optimal for functions that are called only from a small number of places
and for small functions. To prevent increases in code size because of inlining, use
the --auto_inline=0
option. This option causes the compiler to inline intrinsics only.