5.7.7 Options for Controlling Optimization
The options tabulated below control compiler optimizations and are described in the sections that follow.
| Option | Controls |
|---|---|
-O0 | Do not optimize. |
-O
| Optimization level 1. |
-O2 | Optimization level 2. |
-O3 | Speed-orientated optimizations. |
-Os | Size-orientated optimizations. |
-f[no-]align-functions=n | Alignment of the start of functions. |
-f[no-]align-jumps=n | Alignment of jump targets |
-f[no-]align-labels=n | Alignment of all branch targets. |
-f[no-]align-loops=n | Alignment of loops. |
-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. |
-ffat-lto-objects | Requests that the compiler generate 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. |
-finline | Inlining of functions marked with the inline specifier |
-f[no-]inline-functions | Integration of all simple functions into their callers. |
-f[no-]inline-limit=n
| The size limit for inlining functions. |
-finline-small-functions | Integration 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. |
-f[no-]lto | The standard link-time optimizer. |
-flto-partition=algorithm | 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-register-move
| Reassign of register numbers in move and other instructions. |
-f[no-]optimize-sibling-calls | Optimization of sibling and tail recursive calls. |
-fpeel-loops | Reconfigure 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 | How often to run the loop optimizer. |
-f[no-]schedule-insns
| Reordering instructions to eliminate instruction stalls. |
-f[no-]strength-reduce | Loop strength reduction and elimination of iteration variables. |
-f[no-]strict-aliasing | Assumption of the strictest aliasing rules applicable to the language being compiled. |
-f[no-]thread-jumps | Jump-to-branch optimizations. |
-f[no-]toplevel-reorder | Reordering of top-level functions, variables, and
asm statements. |
-ftracer | Perform 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. |
-fuse-linker-plugin | Enable use of a linker plugin during link-time optimization plugin. |
-f[no-]whole-program | More aggressive interprocedural optimizations. |
-fzero-call-used-regs=choice | Overwriting "call-used" registers associated with functions when they return |
