HP Fortran Programmer Guide (766160-001, March 2014)
Table 29 Fine-tuning optimization options (continued)
FunctionLevelLevel
NOTE: This option is valid
only on the PA-RISC systems.
Enable the assertion that
only the files that are
+O4or higher+O[no]whole_program_mode
compiled with this option
directly reference any global
variables and procedures
that are defined in these
files. In other words, this
option asserts that there are
no unseen accesses to the
globals. When this assertion
is in effect, the optimizer can
hold global variables in
registers longer and delete
inlined or cloned global
procedures. This option is in
effect only at +O4level of
optimization.All files
compiled with
+Owhole_program_mode
must also be compiled with
+O4. If any of the files are
compiled with +O4but are
not compiled with
+Owhole_program_mode,
the linker disables the
assertion for all files in the
program.Use this option to
increase performance speed,
but only when you are
certain that only the files
compiled with
+Owhole_program_modedirectly
access any globals that are
defined in these files.The
default is
+Onowhole_program_modewhich
disables the assertion.
Conservative vs. aggressive optimization
At optimization level 2 or higher, the optimizer makes a number of assumptions about the program
it is optimizing—for example, that re-ordering an expression for improved instruction scheduling
will not change its results. In general, these assumptions relate to how closely the target program
conforms to the Fortran90 Standard. For programs that conform to the Standard, it is safe for the
optimizer to apply certain optimizations that can significantly improve performance. For
nonstandard-conforming programs, these same optimizations could change the results or behavior
of the program in ways that may not be acceptable to the programmer.
The +Oconservative and +Oaggressive options enable you to set the optimizer’s assumptions
about which optimizations it can and cannot apply to a program. Each option invokes a subset
of the fine-tuning options that balances safety and performance according to the coding style of
the target program. You can use either option at optimization level 2 or higher.
NOTE: +Oaggressiveand +Oconservativeare incompatible and must not appear on the
same command line.
Conservative vs. aggressive optimization 99