duchengyao / duchengyao.github.io

1 stars 0 forks source link

Options That Control Optimization #12

Open duchengyao opened 2 years ago

duchengyao commented 2 years ago
-O -O1 -O2 -O3
-fauto-inc-dec -falign-functions -fgcse-after-reload
-fbranch-count-reg -falign-jumps -fipa-cp-clone
-fcombine-stack-adjustments -falign-labels -floop-interchange
-fcompare-elim -falign-loops -floop-unroll-and-jam
-fcprop-registers -fcaller-saves -fpeel-loops
-fdce -fcode-hoisting -fpredictive-commoning
-fdefer-pop -fcrossjumping -fsplit-loops
-fdelayed-branch -fcse-follow-jumps -fsplit-paths
-fdse -fcse-skip-blocks -ftree-loop-distribution
-fforward-propagate -fdelete-null-pointer-checks -ftree-partial-pre
-fguess-branch-probability -fdevirtualize -funswitch-loops
-fif-conversion -fdevirtualize-speculatively -fvect-cost-model=dynamic
-fif-conversion2 -fexpensive-optimizations -fversion-loops-for-strides
-finline-functions-called-once -ffinite-loops
-fipa-modref -fgcse -fgcse-lm -Os
-fipa-profile -fhoist-adjacent-loads -falign-functions
-fipa-pure-const -finline-functions -falign-jumps
-fipa-reference -finline-small-functions -falign-labels
-fipa-reference-addressable -findirect-inlining -falign-loops
-fmerge-constants -fipa-bit-cp -fipa-cp -fprefetch-loop-arrays
-fmove-loop-invariants -fipa-icf -fipa-ra -freorder-blocks-algorithm=stc
-fmove-loop-stores -fipa-sra -fipa-vrp
-fomit-frame-pointer -fisolate-erroneous-paths-dereference -Og
-freorder-blocks -flra-remat -fbranch-count-reg
-fshrink-wrap -foptimize-sibling-calls -fdelayed-branch
-fshrink-wrap-separate -foptimize-strlen -fdse
-fsplit-wide-types -fpartial-inlining -fif-conversion
-fssa-backprop -fpeephole2 -fif-conversion2
-fssa-phiopt -freorder-blocks-algorithm=stc -finline-functions-called-once
-ftree-bit-ccp -freorder-blocks-and-partition -fmove-loop-invariants
-ftree-ccp -freorder-functions -fmove-loop-stores
-ftree-ch -frerun-cse-after-loop -fssa-phiopt
-ftree-coalesce-vars -fschedule-insns -ftree-bit-ccp
-ftree-copy-prop -fschedule-insns2 -ftree-dse
-ftree-dce -fsched-interblock -ftree-pta
-ftree-dominator-opts -fsched-spec -ftree-sra
-ftree-dse -fstore-merging
-ftree-forwprop -fstrict-aliasing
-ftree-fre -fthread-jumps
-ftree-phiprop -ftree-builtin-call-dce
-ftree-pta -ftree-loop-vectorize
-ftree-scev-cprop -ftree-pre
-ftree-sink -ftree-slp-vectorize
-ftree-slsr -ftree-switch-conversion
-ftree-sra -ftree-tail-merge
-ftree-ter -ftree-vrp
-funit-at-a-time -fvect-cost-model=very-cheap
duchengyao commented 2 years ago

Specific Optimizations

Options Descriptions
-O<number> Set optimization level to <number>.
-Ofast Optimize for speed disregarding exact standards compliance.
-Og Optimize for debugging experience rather than speed or size.
-Os Optimize for space rather than speed.
-faggressive-loop-optimizations Aggressively optimize loops using language constraints.
-falign-functions Align the start of functions.
-falign-jumps Align labels which are only reached by jumping.
-falign-labels Align all labels.
-falign-loops Align the start of loops.
-fallocation-dce Tell DCE to remove unused C++ allocations.
-fallow-store-data-races Allow the compiler to introduce new data races on stores.
-fassociative-math Allow optimization for floating-point arithmetic which may change the result of
the operation due to rounding.
-fassume-phsa Assume we are finalizing for phsa and its libhsail-rt. Enables additional phsa-
specific optimizations (default).
-fasynchronous-unwind-tables Generate unwind tables that are exact at each instruction boundary.
-fauto-inc-dec Generate auto-inc/dec instructions.
-fbit-tests Use bit tests for sufficiently large switch statements.
-fbranch-count-reg Replace add, compare, branch with branch on count register.
-fbranch-probabilities Use profiling information for branch probabilities.
-fcaller-saves Save registers around function calls.
-fcode-hoisting Enable code hoisting.
-fcombine-stack-adjustments Looks for opportunities to reduce stack adjustments and stack references.
-fcompare-elim Perform comparison elimination after register allocation has finished.
-fconserve-stack Do not perform optimizations increasing noticeably stack usage.
-fcprop-registers Perform a register copy-propagation optimization pass.
-fcrossjumping Perform cross-jumping optimization.
-fcse-follow-jumps When running CSE, follow jumps to their targets.
-fcx-fortran-rules Complex multiplication and division follow Fortran rules.
-fcx-limited-range Omit range reduction step when performing complex division.
-fdce Use the RTL dead code elimination pass.
-fdefer-pop Defer popping functions args from stack until later.
-fdelayed-branch Attempt to fill delay slots of branch instructions.
-fdelete-dead-exceptions Delete dead instructions that may throw exceptions.
-fdelete-null-pointer-checks Delete useless null pointer checks.
-fdevirtualize Try to convert virtual calls to direct ones.
-fdevirtualize-speculatively Perform speculative devirtualization.
-fdse Use the RTL dead store elimination pass.
-fearly-inlining Perform early inlining.
-fexceptions Enable exception handling.
-fexcess-precision=[fast | standard] Specify handling of excess floating-point precision.
-fexpensive-optimizations Perform a number of minor, expensive optimizations.
-ffast-math This option lacks documentation.
-ffinite-loops Assume that loops with an exit will terminate and not loop indefinitely.
-ffinite-math-only Assume no NaNs or infinities are generated.
-ffloat-store Don't allocate floats and doubles in extended-precision registers.
-fforward-propagate Perform a forward propagation pass on RTL.
-ffp-contract=[off | on | fast] Perform floating-point expression contraction.
-ffp-int-builtin-inexact Allow built-in functions ceil, floor, round, trunc to raise "inexact" exceptions.
-ffunction-cse Allow function addresses to be held in registers.
-fgcse Perform global common subexpression elimination.
-fgcse-after-reload Perform global common subexpression elimination after register allocation has
finished.
-fgcse-las Perform redundant load after store elimination in global common subexpression
elimination.
-fgcse-lm Perform enhanced load motion during global common subexpression elimination.
-fgcse-sm Perform store motion after global common subexpression elimination.
-fgraphite Enable in and out of Graphite representation.
-fgraphite-identity Enable Graphite Identity transformation.
-fguess-branch-probability Enable guessing of branch probabilities.
-fhandle-exceptions Same as -fexceptions. Uses of this option are diagnosed.
-fhoist-adjacent-loads Enable hoisting adjacent loads to encourage generating conditional move
instructions.
-fif-conversion Perform conversion of conditional jumps to branchless equivalents.
-fif-conversion2 Perform conversion of conditional jumps to conditional execution.
-findirect-inlining Perform indirect inlining.
-finline Enable inlining of function declared "inline", disabling disables all inlining.
-finline-atomics Inline __atomic operations when a lock free instruction sequence is available.
-finline-functions Integrate functions not declared "inline" into their callers when profitable.
-finline-functions-called-once Integrate functions only required by their single caller.
-finline-small-functions Integrate functions into their callers when code size is known not to grow.
-fipa-bit-cp Perform interprocedural bitwise constant propagation.
-fipa-cp Perform interprocedural constant propagation.
-fipa-cp-clone Perform cloning to make Interprocedural constant propagation stronger.
-fipa-icf Perform Identical Code Folding for functions and read-only variables.
-fipa-icf-functions Perform Identical Code Folding for functions.
-fipa-icf-variables Perform Identical Code Folding for variables.
-fipa-modref Perform interprocedural modref analysis.
-fipa-profile Perform interprocedural profile propagation.
-fipa-pta Perform interprocedural points-to analysis.
-fipa-pure-const Discover pure and const functions.
-fipa-ra Use caller save register across calls if possible.
-fipa-reference Discover read-only and non addressable static variables.
-fipa-reference-addressable Discover read-only, write-only and non-addressable static variables.
-fipa-sra Perform interprocedural reduction of aggregates.
-fipa-stack-alignment Reduce stack alignment on call sites if possible.
-fipa-vrp Perform IPA Value Range Propagation.
-fira-algorithm=[CB | priority] Set the used IRA algorithm.
-fira-hoist-pressure Use IRA based register pressure calculation in RTL hoist optimizations.
-fira-loop-pressure Use IRA based register pressure calculation in RTL loop optimizations.
-fira-region=[one | all | mixed] Set regions for IRA.
-fira-share-save-slots Share slots for saving different hard registers.
-fira-share-spill-slots Share stack slots for spilled pseudo-registers.
-fisolate-erroneous-paths-attribute Detect paths that trigger erroneous or undefined behavior due to a null
value being used in a way forbidden by a returns_nonnull or nonnull attribute.
Isolate those paths from the main control flow and turn the statement with
erroneous or undefined behavior into a trap.
-fisolate-erroneous-paths-dereference Detect paths that trigger erroneous or undefined behavior due to
dereferencing a null pointer. Isolate those paths from the main control flow
and turn the statement with erroneous or undefined behavior into a trap.
-fivopts Optimize induction variables on trees.
-fjump-tables Use jump tables for sufficiently large switch statements.
-fkeep-gc-roots-live This option lacks documentation.
-flifetime-dse=<0,2> Tell DSE that the storage for a C++ object is dead when the constructor starts
and when the destructor finishes.
-flimit-function-alignment This option lacks documentation.
-flive-patching= [inline-only-static | inline-clone]
Control IPA optimizations to provide a safe compilation for live-patching. At the
same time, provides multiple-level control on the enabled IPA optimizations.
-flive-range-shrinkage Relief of register pressure through live range shrinkage.
-floop-interchange Enable loop interchange on trees.
-floop-nest-optimize Enable the loop nest optimizer.
-floop-parallelize-all Mark all loops as parallel.
-floop-unroll-and-jam Perform unroll-and-jam on loops.
-flra-remat Do CFG-sensitive rematerialization in LRA.
-fmath-errno Set errno after built-in math functions.
-fmodulo-sched Perform SMS based modulo scheduling before the first scheduling pass.
-fmodulo-sched-allow-regmoves Perform SMS based modulo scheduling with register moves allowed.
-fmove-loop-invariants Move loop invariant computations out of loops.
-fnon-call-exceptions Support synchronous non-call exceptions.
-fnothrow-opt Treat a throw() exception specification as noexcept to improve code size.
-fomit-frame-pointer When possible do not generate stack frames.
-fopt-info Enable all optimization info dumps on stderr.
-foptimize-sibling-calls Optimize sibling and tail recursive calls.
-foptimize-strlen Enable string length optimizations on trees.
-fpack-struct Pack structure members together without holes.
-fpack-struct=<number> Set initial maximum structure member alignment.
-fpartial-inlining Perform partial inlining.
-fpatchable-function-entry= Insert NOP instructions at each function entry.
-fpeel-loops Perform loop peeling.
-fpeephole Enable machine specific peephole optimizations.
-fpeephole2 Enable an RTL peephole pass before sched2.
-fplt Use PLT for PIC calls (-fno-plt: load the address from GOT at call site).
-fpredictive-commoning Run predictive commoning optimization.
-fprefetch-loop-arrays Generate prefetch instructions, if available, for arrays in loops.
-fprintf-return-value Treat known sprintf return values as constants.
-fprofile-partial-training Do not assume that functions never executed during the train run are cold.
-fprofile-reorder-functions Enable function reordering that improves code placement.
-freciprocal-math Same as -fassociative-math for expressions which include division.
-free Turn on Redundant Extensions Elimination pass.
-freg-struct-return Return small aggregates in registers.
-frename-registers Perform a register renaming optimization pass.
-freorder-blocks Reorder basic blocks to improve code placement.
-freorder-blocks-algorithm= [simple | stc] Set the used basic block reordering algorithm.
-freorder-blocks-and-partition Reorder basic blocks and partition into hot and cold sections.
-freorder-functions Reorder functions to improve code placement.
-frerun-cse-after-loop Add a common subexpression elimination pass after loop optimizations.
-freschedule-modulo-scheduled-loops Enable/Disable the traditional scheduling in loops that already passed
modulo scheduling.
-frounding-math Disable optimizations that assume default FP rounding behavior.
-frtti Generate run time type descriptor information.
-fsave-optimization-record Write a SRCFILE.opt-record.json file detailing what optimizations were performed.
-fsched-critical-path-heuristic Enable the critical path heuristic in the scheduler.
-fsched-dep-count-heuristic Enable the dependent count heuristic in the scheduler.
-fsched-group-heuristic Enable the group heuristic in the scheduler.
-fsched-interblock Enable scheduling across basic blocks.
-fsched-last-insn-heuristic Enable the last instruction heuristic in the scheduler.
-fsched-pressure Enable register pressure sensitive insn scheduling.
-fsched-rank-heuristic Enable the rank heuristic in the scheduler.
-fsched-spec Allow speculative motion of non-loads.
-fsched-spec-insn-heuristic Enable the speculative instruction heuristic in the scheduler.
-fsched-spec-load Allow speculative motion of some loads.
-fsched-spec-load-dangerous Allow speculative motion of more loads.
-fsched-stalled-insns Allow premature scheduling of queued insns.
-fsched-stalled-insns-dep Set dependence distance checking in premature scheduling of queued insns.
-fsched-stalled-insns-dep=<number> Set dependence distance checking in premature scheduling of queued insns.
-fsched-stalled-insns=<number> Set number of queued insns that can be prematurely scheduled.
-fsched2-use-superblocks If scheduling post reload, do superblock scheduling.
-fschedule-fusion Perform a target dependent instruction fusion optimization pass.
-fschedule-insns Reschedule instructions before register allocation.
-fschedule-insns2 Reschedule instructions after register allocation.
-fsection-anchors Access data in the same section from shared anchor points.
-fsel-sched-pipelining Perform software pipelining of inner loops during selective scheduling.
-fsel-sched-pipelining-outer-loops Perform software pipelining of outer loops during selective scheduling.
-fsel-sched-reschedule-pipelined Reschedule pipelined regions without pipelining.
-fselective-scheduling Schedule instructions using selective scheduling algorithm.
-fselective-scheduling2 Run selective scheduling after reload.
-fshort-enums Use the narrowest integer type possible for enumeration types.
-fshort-wchar Force the underlying type for "wchar_t" to be "unsigned short".
-fshrink-wrap Emit function prologues only before parts of the function that need it, rather
than at the top of the function.
-fshrink-wrap-separate Shrink-wrap parts of the prologue and epilogue separately.
-fsignaling-nans Disable optimizations observable by IEEE signaling NaNs.
-fsigned-zeros Disable floating point optimizations that ignore the IEEE signedness of zero.
-fsimd-cost-model= [unlimited | dynamic | cheap | very-cheap]
Specifies the vectorization cost model for code marked with a simd directive.
-fsingle-precision-constant Convert floating point constants to single precision constants.
-fsplit-ivs-in-unroller Split lifetimes of induction variables when loops are unrolled.
-fsplit-loops Perform loop splitting.
-fsplit-paths Split paths leading to loop backedges.
-fsplit-wide-types Split wide types into independent registers.
-fsplit-wide-types-early Split wide types into independent registers earlier.
-fssa-backprop Enable backward propagation of use properties at the SSA level.
-fssa-phiopt Optimize conditional patterns using SSA PHI nodes.
-fstack-check= [no | generic | specific] Insert stack checking code into the program.
-fstack-clash-protection Insert code to probe each page of stack space as it is allocated to protect from
stack-clash style attacks.
-fstack-protector Use propolice as a stack protection method.
-fstack-protector-all Use a stack protection method for every function.
-fstack-protector-explicit Use stack protection method only for functions with the stack_protect attribute.
-fstack-protector-strong Use a smart stack protection method for certain functions.
-fstack-reuse= [all | named_vars | none] Set stack reuse level for local variables.
-fstdarg-opt Optimize amount of stdarg registers saved to stack at start of function.
-fstore-merging Merge adjacent stores.
-fstrict-aliasing Assume strict aliasing rules apply.
-fstrict-enums Assume that values of enumeration type are always within the minimum range of
that type.
-fstrict-volatile-bitfields Force bitfield accesses to match their type width.
-fthread-jumps Perform jump threading optimizations.
-fno-threadsafe-statics Do not generate thread-safe code for initializing local statics.
-ftoplevel-reorder Reorder top level functions, variables, and asms.
-ftracer Perform superblock formation via tail duplication.
-ftrapping-math Assume floating-point operations can trap.
-ftrapv Trap for signed overflow in addition, subtraction and multiplication.
-ftree-bit-ccp Enable SSA-BIT-CCP optimization on trees.
-ftree-builtin-call-dce Enable conditional dead code elimination for builtin calls.
-ftree-ccp Enable SSA-CCP optimization on trees.
-ftree-ch Enable loop header copying on trees.
-ftree-coalesce-vars Enable SSA coalescing of user variables.
-ftree-copy-prop Enable copy propagation on trees.
-ftree-cselim Transform condition stores into unconditional ones.
-ftree-dce Enable SSA dead code elimination optimization on trees.
-ftree-dominator-opts Enable dominator optimizations.
-ftree-dse Enable dead store elimination.
-ftree-forwprop Enable forward propagation on trees.
-ftree-fre Enable Full Redundancy Elimination (FRE) on trees.
-ftree-loop-distribute-patterns Enable loop distribution for patterns transformed into a library call.
-ftree-loop-distribution Enable loop distribution on trees.
-ftree-loop-if-convert Convert conditional jumps in innermost loops to branchless equivalents.
-ftree-loop-im Enable loop invariant motion on trees.
-ftree-loop-ivcanon Create canonical induction variables in loops.
-ftree-loop-optimize Enable loop optimizations on tree level.
-ftree-loop-vectorize Enable loop vectorization on trees.
-ftree-lrs Perform live range splitting during the SSA->normal pass.
-ftree-parallelize-loops=<number> Enable automatic parallelization of loops.
-ftree-partial-pre In SSA-PRE optimization on trees, enable partial-partial redundancy elimination.
-ftree-phiprop Enable hoisting loads from conditional pointers.
-ftree-pre Enable SSA-PRE optimization on trees.
-ftree-pta Perform function-local points-to analysis on trees.
-ftree-reassoc Enable reassociation on tree level.
-ftree-scev-cprop Enable copy propagation of scalar-evolution information.
-ftree-sink Enable SSA code sinking on trees.
-ftree-slp-vectorize Enable basic block vectorization (SLP) on trees.
-ftree-slsr Perform straight-line strength reduction.
-ftree-sra Perform scalar replacement of aggregates.
-ftree-switch-conversion Perform conversions of switch initializations.
-ftree-tail-merge Enable tail merging on trees.
-ftree-ter Replace temporary expressions in the SSA->normal pass.
-ftree-vectorize Enable vectorization on trees.
-ftree-vrp Perform Value Range Propagation on trees.
-funconstrained-commons Assume common declarations may be overridden with ones with a larger trailing
array.
-funroll-all-loops Perform loop unrolling for all loops.
-funroll-completely-grow-size This option lacks documentation.
-funroll-loops Perform loop unrolling when iteration count is known.
-funsafe-math-optimizations Allow math optimizations that may violate IEEE or ISO standards.
-funswitch-loops Perform loop unswitching.
-funwind-tables Just generate unwind tables for exception handling.
-fvar-tracking Perform variable tracking.
-fvar-tracking-assignments Perform variable tracking by annotating assignments.
-fvar-tracking-assignments-toggle Toggle -fvar-tracking-assignments.
-fvar-tracking-uninit Perform variable tracking and also tag variables that are uninitialized.
-fvariable-expansion-in-unroller Apply variable expansion when loops are unrolled.
-fvect-cost-model= [unlimited | dynamic | cheap | very-cheap]
Specifies the cost model for vectorization.
-fversion-loops-for-strides Version loops based on whether indices have a stride of one.
-fvpt Use expression value profiles in optimizations.
-fweb Construct webs and split unrelated uses of single variable.
-fwrapv Assume signed arithmetic overflow wraps around.
-fwrapv-pointer Assume pointer overflow wraps around.