XL Fortran for AIX 8.1

User's Guide


Choosing an Optimization Level

Optimization requires additional compilation time, but usually results in a faster run time. XL Fortran allows you to select whether you want optimization to be performed at compile time. By default, the compiler performs only very minor optimizations. For the fastest compile time, we recommend not optimizing a program that you are debugging or compiling to check syntax.

Specify the -O compiler option, with an optional digit that signifies the level, to enable compiler optimization. The default level is 2.

-O0, the default compiler state, only performs minimal optimizations.

-O2 performs control and data flow analysis for the entire program unit. This analysis allows optimizations, such as common expression elimination, strength reduction, code motion, and global register assignment. When you use this option, the compiler pays particular attention to innermost loops and to subscript address calculations. The compiler keeps variables in registers wherever possible to eliminate unnecessary loads and stores.

-O2 performs many powerful optimization techniques that generally result in improved code and do not result in excessive compile times.

-O3 performs the -O2-level optimizations and additional optimizations that may have the following effects:

We recommend that you use the -O3 option where run-time performance is a crucial factor and machine resources can accommodate the extra compile-time work.

The exact optimizations that are performed depend on a number of factors:

The -O4 compiler option implies the -O3 compiler option, as well as -qhot and -qipa options.

Specifying the -O5 option is equivalent to specifying the -O4 option plus -qipa=level=2. If -O5 is specified on the compile step, then it should be specified on the link step, as well. Although the -qipa option is not strictly another optimization level, it extends the optimizations across procedures (even if the procedures are in different files). It enhances the effectiveness of the optimizations that are done by other optimization options, particularly -O (at any level) and -Q. Because it can also increase compile time substantially, you may want to use it primarily for tuning applications that are already debugged and ready to be used.


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