•Software pipelining.
•Register reassociation.
Level 2 can produce faster runtime code than level 1 if programs use loops extensively.
Operating system and interactive applications that use the already optimized system libraries can achieve 30% to 50% additional improvement. Level 2 optimization produces faster programs than level 1 and compiles faster than level 3 optimization.
Level 3 Optimization
Level 3 optimization includes level 2 optimizations, along with full optimization across all subprograms within a single file. Level 3 also inlines certain subprograms within the input file. Use +O3 to get level 3 optimization.
Level 3 optimization produces faster runtime code than level 2 on code that does many procedure calls to small functions. Level 3 links faster than level 4. But level 3 does not work with the debugger options
Level 4 Optimization
Level 4 optimization includes level 3 optimizations, along with full optimizations across the entire application program. Level 4 includes global and static variable optimization and inlining across the entire program. Optimizations are performed at link time rather than at compile time. Use +O4 to get level 4 optimization.
Level 4 optimization produces faster runtime code than level 3 if programs use many global variables or if there are many opportunities for inlining procedure calls. But level 4 does not work with the debugger options
Additional Options for Finer Control
In addition to basic optimization levels, optimization options are provided should you require a more precise level of control.
Some introductory examples follow:
Enabling Aggressive Optimizations
To enable aggressive optimizations at the second, third, or fourth optimization levels, use the +Ofast option as follows:
aCC +Ofast +O2 sourcefile.C
or:
aCC +Ofast +O3 sourcefile.C
or:
aCC +Ofast +O4 sourcefile.C
This option enables additional optimizations at each level.
NOTE: Use aggressive optimizations with stable,
These optimizations may do any of the following:
•Relocate conditional
•Convert certain library calls to millicode and inline instructions
•Alter
Requesting Optimization 157