5.7.7 Options for Controlling Optimization

The options tabulated below control compiler optimizations and are described in the sections that follow.

Use of an option is permitted and has an effect with an unlicensed compiler (Free edition) if that option is enabled by default when using optimization level 2 or lower. Any form of option that disables an optimization is available unconditionally.

Table 5-13. Optimization Options
Option Edition Controls
-O0 All Do not optimize.
-O

-O1

All Optimization level 1.
-O2 All Optimization level 2.
-O3 PRO only Speed-orientated optimizations.
-Os PRO only Size-orientated optimizations.
-falign-functions[=n]

-f[no-]align-functions

All Alignment of the start of functions.
-falign-labels[=n]

-f[no-]align-labels

All Alignment of all branch targets.
-falign-loops[=n]

-f[no-]align-loops

All Alignment of loops.
-f[no-]caller-saves All Allocation into registers clobbered by function calls.
-f[no-]cse-follow-jumps All Customization of common subexpression elimination optimizations.
-f[no-]cse-skip-blocks All Customization of common subexpression elimination optimizations.
-f[no-]data-sections All Placement of objects into a section in the output file.
-f[no-]defer-pop All When arguments to function calls are popped.
-f[no-]expensive-optimizations All Minor optimizations that are relatively expensive.
-f[no-]function-cse All Placement of function addresses.
-f[no-]function-sections All Placement of functions intoa section in the output file.
-f[no-]gcse All The global common subexpression elimination pass.
-f[no-]gcse-lm All Customization of common subexpression elimination dealing with loads.
-f[no-]gcse-sm All Customization of common subexpression elimination dealing with stores.
-f[no-]inline-functions All Integratation of all simple functions into their callers.
-f[no-]inline-limit=n All The size limit for inlining functions.
-f[no-]keep-inline-functions All Output of a separate run-time-callable version of inlined functions.
-f[no-]keep-static-consts All Output of static const objects.
-f[no-]lto PRO only The standard link-time optimizer.
-f[no-]omit-frame-pointer All Reservation of the Frame Pointer in a register for functions that don't need one.
-f[no-]optimize-register-move

-f[no-]regmove

All Reassign of register numbers in move and other instructions.
-f[no-]optimize-sibling-calls All Optimization of sibling and tail recursive calls.
-f[no-]peephole

-f[no-]peephole2

All Machine-specific peephole optimizations.
-f[no-]rename-registers All Use of free registers to avoid false dependencies in scheduled code.
-f[no-]rerun-cse-after-loop All When common subexpression elimination optimizations should be performed.
-f[no-]rerun-loop-opt All How often to run the loop optimizer.
-f[no-]schedule-insns

-f[no-]schedule-insns2

All Reordering instructions to eliminate instruction stalls.
-f[no-]strength-reduce All Loop strength reduction and elimination of iteration variables.
-f[no-]strict-aliasing All Assumption of the strictest aliasing rules applicable to the language being compiled.
-f[no-]thread-jumps All Jump-to-branch optimizations.
-f[no-]toplevel-reorder All Reordering of top-level functions, variables, and asm statements.
-f[no-]unroll-loops

-f[no-]unroll-all-loops

All Loop unrolling.
-f[no-]whole-program PRO only More aggressive interprocedural optimizations.