Sun Studio 12: C User's Guide

B.2.117.2 Explanation of x86 Optimizations

The following table describes how the optimization levels work on the x86 platform.

Table B–32 The -xO Flags on x86 Platforms

Value 

Meaning  

-xO1

Preloads arguments from memory, cross-jumping (tail-merging), as well as the single pass of the default optimization. 

-xO2

Schedules both high- and low-level instructions and performs improved spill analysis, loop memory-reference elimination, register lifetime analysis, enhanced register allocation, and elimination of global common subexpressions. 

-xO3

Performs loop strength reduction, induction variable elimination, as well as the optimization done by level 2.

-xO4

Preforms automatic inlining of functions contained in the same file in addition to performing -xO3 optimizations. This automatic inlining usually improves execution speed, but sometimes makes it worse. In general, this level results in increased code size.

-xO5

Generates the highest level of optimization. Uses optimization algorithms that take more compilation time or that do not have as high a certainty of improving execution time. Some of these include generating local calling convention entry points for exported functions, further optimizing spill code and adding analysis to improve instruction scheduling. 

For more information on debugging, see the Sun Studio 12: Debugging a Program With dbx manual. For more information on optimization, see theSun Studio 12: Performance Analyzer manual.

See also -xldscope and -xmaxopt.