Setting Optimization Levels

Depending on the Intel architecture, optimization can have different effects. To specify optimizations for your target architecture, refer to the tables below.

Itanium® Compiler

Option Effect
-O1 Optimizes for code size by turning off software pipelining. Enables the same optimizations as -O except for loop unrolling and software pipelining. -O and -O2 turn on software pipelining. Generally, -O or -O2 are recommended over -O1.

IA-32 Compiler

Option Effect
-O,
-O1
,
-O2
Optimize for speed. Disable option -fp. The -O2 option is ON by default. Intrinsic recognition is disabled.
-O3 Enables -O2 option with more aggressive optimization. Optimizes for maximum speed, but does not guarantee higher performance unless loop and memory access transformation take place. In conjunction with -axK and -xK options (IA-32 only), this option causes the compiler to perform more aggressive data dependency analysis than for -O2. This may result in longer compilation times.

IA-32 and Itanium Compilers

Option Effect
-O2 ON by default. -O2 turns ON intrinsics inlining. Enables the following capabilities for performance gain:
  • Constant propagation
  • Copy propagation
  • Dead-code elimination
  • Global register allocation
  • Global instruction scheduling and control speculation
  • Loop unrolling
  • Optimized code selection
  • Partial redundancy elimination
  • Strength reduction/induction variable simplification
  • Variable renaming
  • Exception handling optimizations
  • Tail recursions
  • Peephole optimizations
  • Structure assignment lowering and optimizations
  • Dead store elimination
-O3 Enables -O2 option with more aggressive optimization, for example, prefetching, scalar replacement, and loop transformations. Optimizes for maximum speed, but does not guarantee higher performance unless loop and memory access transformation take place. To time your application, see Timing Your Application.