6.7.7 Options for Controlling Optimization
The options tabulated below control compiler optimizations and are described in the sections that follow.
| Option (links to explanatory section) | Controls |
|---|---|
-O0 | Disabling of all optimizations. |
-O
| Optimization level 1. |
-O2 | Optimization level 2. |
-O3 | Speed-orientated optimizations. |
-Og |
Less optimizations for better debugging. |
-Os | Size-orientated optimizations. |
-madj-exiting-edge-prob | Rearrangement of basic blocks within loops. |
-falign-functions[=n]
| Alignment of the start of functions. |
-falign-jumps | |
-falign-labels[=n]
| Alignment of all branch targets. |
-falign-loops[=n]
| Alignment of loops. |
-mauto-indexing | Substitution of load-then-increment sequences. |
-f[no-]caller-saves | Allocation into registers clobbered by function calls. |
-f[no-]cse-follow-jumps | Customization of common subexpression elimination optimizations. |
-f[no-]cse-skip-blocks | Customization of common subexpression elimination optimizations. |
-f[no-]data-sections | Placement of objects into a section in the output file. |
-f[no-]defer-pop | When arguments to function calls are popped. |
-f[no-]expensive-optimizations | Minor optimizations that are relatively expensive. |
-f[no-]fat-lto-objects | Generation of fat object files. |
-f[no-]function-cse | Placement of function addresses. |
-f[no-]function-sections | Placement of functions into a section in the output file. |
-f[no-]gcse | The global common subexpression elimination pass. |
-f[no-]gcse-lm | Customization of common subexpression elimination dealing with loads. |
-f[no-]gcse-sm | Customization of common subexpression elimination dealing with stores. |
-f[no-]inline | Controls processing of functions marked with
theinline keyword. |
-f[no-]inline-functions | Integratation of all simple functions into their callers. |
-f[no-]inline-limit=n | The size limit for inlining functions. |
-finline-small-functions | Integratation of all simple functions into their callers. |
-f[no-]keep-inline-functions | Output of a separate run-time-callable version of inlined functions. |
-f[no-]keep-static-consts | Output of static const objects. |
-mloop-rename-registers | Reallocation of values within loops to low-numbered registers. |
-f[no-]lto | The standard link-time optimizer. |
-flto-partition=algorithm | Selection of the link-time optimizer algorithm used to partition object files. |
-f[no-]omit-frame-pointer | Reservation of the Frame Pointer in a register for functions that don't need one. |
-f[no-]optimize-sibling-calls | Optimization of sibling and tail recursive calls. |
-m[no-]pa | Procedural Abstraction optimizations. |
-f[no-]peel-loops | Reconfiguration of loops in the source code. |
-f[no-]peephole
| Machine-specific peephole optimizations. |
-f[no-]rename-registers | Use of free registers to avoid false dependencies in scheduled code. |
-f[no-]rerun-cse-after-loop | When common subexpression elimination optimizations should be performed. |
-f[no-]rerun-loop-opt | Legacy option and is ignored. |
-f[no-]schedule-insns
| Reordering instructions to eliminate instruction stalls. |
-f[no-]strength-reduce | Legacy Option and is ignored. |
-f[no-]strict-aliasing | Assumption of the strictest aliasing rules applicable to the language being compiled. |
-mthumb2-align-loop | Alignment of loops to avoid pipeline reloads. |
-f[no-]thread-jumps | Jump-to-branch optimizations. |
-f[no-]toplevel-reorder | Reordering of top-level functions, variables, and
asm statements. |
-f[no-]tracer | Tail duplication. |
-ftree-vrp | Perform value range propagation. |
-ftrivial-auto-var-init=choice | Initialize automatic variables that have not been explicitly initialized in the source code |
-f[no-]unroll-loops
| Loop unrolling. |
-f[no-]use-linker-plugin | Use of a linker plugin during link-time optimization. |
-fzero-call-used-regs=choice | Overwriting "call-used" registers associated with functions when they return |
