HP Fortran Programmer's Guide (March 2010)
Performance and optimization
Conservative vs. aggressive optimization
Chapter 6 165
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 Fortran 90 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 +Oaggressive and +Oconservative are incompatible and must not appear on
the same command line.
Table on page 165 lists the assumptions that the optimizer makes about your program when
you compile with +Oconservative, +Oaggressive, or neither option (the default). The table
also lists the fine-tuning options that are invoked by +Oconservative and +Oaggressive.
The options listed for the default case are the subset of the ones invoked by +Oconservative
and +Oaggressive. For information about the fine-tuning options listed in the third column,
see Table on page 155.
Table 6-4 Conservative, aggressive, and default optimizations
Specified options Assumptions Invoked options
+Onoconservative
+Onoaggressive
(the default)
• Standard-conforming +Onoentrysched
+Omoveflops
+Onoparmsoverlap
+Onovectorize