Each of the command-line options: -O,-O1, -O2 and -O3 turn on several compiler capabilities. See the summary of these options.
The following table provides a summary of the optimizations that the
compiler applies when you invoke
-O, -O1 and/or -O2,
or -O3 optimizations.
Option |
Optimization |
Affected Aspect of Program |
-O1, -O2 |
global register allocation |
register use |
-O1, -O2 |
instruction scheduling |
instruction reordering |
-O1, -O2 |
register variable detection |
register use |
-O1, -O2 |
common subexpression elimination |
constants and expression evaluation |
-O1, -O2 |
dead-code elimination |
instruction sequencing |
-O1, -O2 |
variable renaming |
register use |
-O1, -O2 |
copy propagation |
register use |
-O1, -O2 |
constant propagation |
constants and expression evaluation |
-O1, -O2 |
strength reduction-induction variable |
simplification instruction, |
-O1, -O2 |
tail recursion elimination |
calls, further optimization |
-O, -O2 |
software pipelining for Itanium-based application |
calls, further optimization |
-O2 |
loop unrolling; inlining of intrinsics |
calls, further optimization |
-O3 |
prefetching, scalar replacement, |
memory access, instruction parallelism, predication, software pipelining |