HP Fortran Programmer's Guide (September 2007)
Performance and optimization
Using options to control optimization
Chapter 6146
Using the optimization options
The +O
optimization
options enable you to control the kind of optimizations that are applied
to your program at each level. Table on page 147 and Table 6-3 on page 149 list the options.
The first column of each table lists each option, the second column gives the optimization level
at which the option can be used, and the third column identifies what the option does. When
using any of these options except +Oall, you must also use the +O
n
option to specify the
optimization level listed in the second column of the tables. The +Oall option automatically
invokes the optimizer at the highest level.
Table 6-2 lists the “packaged” options. These options enable or disable a set of related
optimizations, such as optimizations that do not increase code size. Table 6-3 lists options that
enable or disable specific optimizations.
+O3 Level 2 optimizations,
plus loop transforms,
parallelization,
vectorization, cloning,
and inlining within a
file. Some
optimizations may
require additional
options; see “Using the
optimization options”
on page 146.
Can
significantly
increase
performance
over level 2.
Compiles slower
than lower
levels; increases
object code size;
not compatible
with the
debugger option
-g.
When building
the production
version;
especially
effective when
used on source
files containing
frequently
executed loops
and
subprograms.
+O4 Level 3 optimizations
applied across all
program files compiled
with +O4.
Provides the
highest level of
optimization;
can
significantly
increase
performance
over level 3.
Can use large
amounts of
system
resources; may
increase
link-time and
object code size;
not compatible
with the
debugger option
-g.
When building
the production
version;
especially
effective when
used on source
files containing
frequently
executed loops
and
subprograms.
Table 6-1 Optimization levels (Continued)
Option
Optimizations
performed Advantages Disadvantages
Recommended
use