-qinline

Category

Optimization and tuning

@PROCESS

None.

Purpose

Attempts to inline procedures instead of generating calls to those procedures, for improved performance.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-+- -qinline-+----------------------------+-+----------------><
   |           |   .-:--------------------. | |   
   |           |   V                      | | |   
   |           +-=---+-auto-------------+-+-+ |   
   |           |     +-noauto-----------+   | |   
   |           |     '-level--=--number-'   | |   
   |           |         .-:--------------. | |   
   |           |         V                | | |   
   |           '-+- + +----procedure_name-+-' |   
   |             '- - '                       |   
   '- -qnoinline------------------------------'   

Defaults

If -qinline is not specified, the default option is -qnoinline at the -O0 or -qnoopt optimization level or -qinline=noauto:level=5 at the -O2 or higher optimization levels.

If -qinline is specified without any suboptions, the default option is -qinline=auto:level=5.

Parameters

noauto | auto
Enables or disables automatic inlining.
level=number
Represents the relative degree of inlining. The values for number must be positive integers from 0 to 10 inclusive. The default value for number is 5. The greater the value of number, the more aggressive inlining the compiler conducts.
procedure_name
If the procedure_name is specified after the -qinline+ option, the named procedure must be inlined. If the procedure_name is specified after the -qinline- option, the named procedure must not be inlined.

Usage

You can specify -qinline with any optimization level of -O2, -O3, -O4, or -O5 to enable inlining of procedures.

When -qinline is in effect, the compiler determines whether inlining a specific procedure can improve performance. That is, whether a procedure is appropriate for inlining is subject to two factors: limits on the number of inlined calls and the amount of code size increase as a result. Therefore, enabling inlining a procedure does not guarantee that procedure will be inlined.

Because inlining does not always improve runtime performance, you need to test the effects of this option on your code. Do not attempt to inline recursive or mutually recursive procedures.

You can use the -qinline+<procedure_name> or -qinline-<procedure_name> option to specify the procedures that must be inlined or must not be inlined.

Specifying -qnoinline disables all inlining, including that achieved by the high-level optimizer with the -qipa option.

If you specify the -g option to generate debugging information, the inlining effect of -qinline might be suppressed.

If you specify the -qcompact option to avoid optimizations that increase code size, the inlining effect of -qinline might be suppressed.

By default, -qinline affects only internal or module procedures. To turn on inline expansion for calls to procedures in different scopes, you must also use the -qipa option.

Conflicting @PROCESS directives or compilation options that are applied to different compilation units can impact inlining effectiveness. For example, if you specify inlining for a procedure, some @PROCESS compiler directives can be rendered ineffective. See the XL Fortran Optimization and Programming Guide for more information about inlining and IPA.

If you specify inlining for a procedure, the following @PROCESS compiler directives are only effective if they come before the first compilation unit in the file: ALIAS, ALIGN, ATTR, COMPACT, DBG, EXTCHK, EXTNAME, FLOAT, FLTTRAP, HALT, IEEE, LIST, MAXMEM, OBJECT, OPTIMIZE, PHSINFO, SPILLSIZE, STRICT, and XREF.

Note:
  • -qinline replaces -Q and its suboptions.
  • -Q, -Q!, -Q+name, and -Q-name are all deprecated options and suboptions.
  • -qipa=inline and all of its associated suboptions are deprecated. -qinline replaces them all.

Examples

Example 1
To compile myprogram.f so that no procedures are inlined, use the following command:
xlf myprogram.f -O2 -qnoinline
If you want to enable automatic inlining, you use the auto suboption:
-O2 -qinline=auto
You can specify an inlining level 6 - 10 to achieve more aggressive automatic inlining. For example:
-O2 -qinline=auto:level=7
If automatic inlining is already enabled by default and you want to specify an inlining level of 7, you enter:
-O2 -qinline=level=7
Example 2
Assuming myprogram.f contains the salary, taxes, expenses, and benefits procedures, you can use the following command to compile myprogram.f to inline these procedures:
xlf myprogram.f -O2 -qinline+salary:taxes:expenses:benefits
If you do not want the procedures salary, taxes, expenses, and benefits to be inlined, use the following command to compile myprogram.f:
xlf myprogram.f -O2 -qinline-salary:taxes:expenses:benefits
You can also disable automatic inlining and specify certain procedures to be inlined with the -qininline+ option. For example:
-O2 -qinline=noauto -qinline+salary:taxes:benefits
In this case, the procedures salary, taxes, and benefits are inlined. Besides, procedures that are declared with the inline specifier are also inlined. No other procedures are inlined.
You cannot mix the + and - suboptions with each other or with other -qinline suboptions. For example, the following options are invalid suboption combinations:
-qinline+increase-decrease    // invalid
-qinline=level=5+increase     // invalid
However, you can use -qinline separately. For example:
-qinline+increase -qinline-decrease -qinline=noauto:level=5

Related information