XL Fortran for AIX 8.1

User's Guide


Optimizing Subprogram Calls

If a program has many subprogram calls, you can use the -Q option to turn on inlining, which reduces the overhead of such calls. Consider using the -p or -pg option with prof or gprof, respectively, to determine which subprograms are called most frequently and to list their names on the command line.

To make inlining apply to calls where the calling and called subprograms are in different source files, include the -qipa option also.

# Let the compiler decide (relatively cautiously) what to inline.
xlf95 -O3 -Q inline.f
 
# Encourage the compiler to inline particular subprograms.
xlf95 -O3 -Q -Q+called_100_times:called_1000_times inline.f
 
# Extend the inlining to calls across files.
xlf95 -O3 -Q -Q+called_100_times:called_1000_times -qipa inline.f
Related Information:
See -Q Option and -qipa Option.

Finding the Right Level of Inlining

Getting the right amount of inlining for a particular program may require some work on your part. The compiler has a number of safeguards and limits to avoid doing an excessive amount of inlining. Otherwise, it might perform less overall optimization because of storage constraints during compilation, or the resulting program might be much larger and run slower because of more frequent cache misses and page faults. However, these safeguards may prevent the compiler from inlining subprograms that you do want inlined. If this happens, you will need to do some analysis or rework or both to get the performance benefit.

As a general rule, consider identifying a few subprograms that are called most often, and inline only those subprograms.

Some common conditions that prevent -Q from inlining particular subprograms are:

To change the size limits that control inlining, you can specify -qipa=limit=n, where n is 0 through 9. Larger values allow more inlining.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]