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.
Option (links to explanatory section) | Edition | Controls |
---|---|---|
-O0 | All | Disabling of all optimizations. |
-O
| All | Optimization level 1. |
-O2 | All | Optimization level 2. |
-O3 | PRO only | Speed-orientated optimizations. |
-Og | All | Less optimizations for better debugging. |
-Os | PRO only | Size-orientated optimizations. |
-madj-exiting-edge-prob |
All | Rearrangement of basic blocks within loops. |
-falign-functions[=n]
| All | Alignment of the start of functions. |
-falign-labels[=n]
| All | Alignment of all branch targets. |
-falign-loops[=n]
| All | Alignment of loops. |
-mauto-indexing |
All | Substitution of load-then-increment sequences. |
-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-]fat-lto-objects |
All | Generation of fat object files. |
-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 | All | Controls processing of functions marked with theinline keyword. |
-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. |
-finline-small-functions |
All | Integratation of all simple functions into their callers. |
-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. |
-mloop-rename-registers |
All | Reallocation of values within loops to low-numbered registers. |
-f[no-]lto | PRO only | The standard link-time optimizer. |
-flto-partition=algorithm |
PRO only | Selection of the link-time optimizer algorithm used to partition object files. |
-f[no-]omit-frame-pointer | All | Reservation of the Frame Pointer in a register for functions that don't need one. |
-f[no-]optimize-sibling-calls | All | Optimization of sibling and tail recursive calls. |
-m[no-]pa | PRO | Procedural Abstraction optimizations. |
-f[no-]peel-loops |
All | Reconfiguration of loops in the source code. |
-f[no-]peephole
| 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 | Legacy option and is ignored. |
-f[no-]schedule-insns
| All | Reordering instructions to eliminate instruction stalls. |
-f[no-]strength-reduce | All | Legacy Option and is ignored. |
-f[no-]strict-aliasing | All | Assumption of the strictest aliasing rules applicable to the language being compiled. |
-mthumb2-align-loop |
All | Alignment of loops to avoid pipeline reloads. |
-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-]tracer |
All | Tail duplication. |
-f[no-]unroll-loops
| All | Loop unrolling. |
-f[no-]use-linker-plugin |
All | Use of a linker plugin during link-time optimization. |