Specifies whether to optimize code during compilation and, if so, at which level.
-qOPTimize is the long form of -O.
Option: .-0-. >>- -O--+---+-------------------------------------------------->< +-1-+ +-2-+ +-3-+ +-4-+ '-5-'
@PROCESS:
@PROCESS OPTimize[(level)] | NOOPTimize
nooptimize or -O0 or optimize=0
This level of optimization also affects the setting of the -qfloat option, turning on the fltint and rsqrt suboptions by default, and sets -qmaxmem=-1.
Specifying -O3 implies -qhot=level=0, unless you explicitly specify -qhot or -qhot=level=1.
Note that the auto setting of -qarch, -qtune, and -qcache implies that the execution environment will be the same as the compilation environment.
This option follows the "last option wins" conflict resolution rule, so any of the options that are modified by -O4 can be subsequently changed. For example, specifying -O4 -qarch=ppc allows aggressive intraprocedural optimization while maintaining code portability.
To obtain the same floating-point accuracy for optimized and non-optimized applications, you must specify the -qfloat=nomaf compiler option. In cases where differences in floating-point accuracy still occur after specifying -qfloat=nomaf, the -qstrict compiler option allows you to exert greater control over changes that optimization can cause in floating-point semantics.
Generally, use the same optimization level for both the compile and link steps. This is important when using either the -O4 or -O5 optimization level to get the best runtime performance. For the -O5 level, all loop transformations (as specified via the -qhot option) are done at the link step.
Increasing the level of optimization may or may not result in additional performance improvements, depending on whether the additional analysis detects any further optimization opportunities.
An optimization level of -O3 or higher can change the behavior of the program and potentially cause exceptions that would not otherwise occur. Use of the -qstrict option maintains the same program behavior as with -O2, at the cost of optimization opportunity. Refer to the -qstrict option for the list of optimizations it disables.
When you use -O or higher optimization, -qtbtable=small is in effect. The traceback table generated has no function name or parameter information.
If the -O option is used in an @PROCESS statement, only an optimization level of 0, 2, or 3 is allowed. Note that unlike using -O3 in command line invocation, specifying @PROCESS OPT(3) does not imply -qhot=level=0.
Compilations with optimization may require more time and machine resources than other compilations.
The more the compiler optimizes a program, the more difficult it is to debug the program with a symbolic debugger.