1<html lang="en"> 2<head> 3<title>Optimize Options - Using the GNU Compiler Collection (GCC)</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Using the GNU Compiler Collection (GCC)"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Invoking-GCC.html#Invoking-GCC" title="Invoking GCC"> 9<link rel="prev" href="Debugging-Options.html#Debugging-Options" title="Debugging Options"> 10<link rel="next" href="Preprocessor-Options.html#Preprocessor-Options" title="Preprocessor Options"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<!-- 13Copyright (C) 1988-2013 Free Software Foundation, Inc. 14 15Permission is granted to copy, distribute and/or modify this document 16under the terms of the GNU Free Documentation License, Version 1.3 or 17any later version published by the Free Software Foundation; with the 18Invariant Sections being ``Funding Free Software'', the Front-Cover 19Texts being (a) (see below), and with the Back-Cover Texts being (b) 20(see below). A copy of the license is included in the section entitled 21``GNU Free Documentation License''. 22 23(a) The FSF's Front-Cover Text is: 24 25 A GNU Manual 26 27(b) The FSF's Back-Cover Text is: 28 29 You have freedom to copy and modify this GNU Manual, like GNU 30 software. Copies published by the Free Software Foundation raise 31 funds for GNU development.--> 32<meta http-equiv="Content-Style-Type" content="text/css"> 33<style type="text/css"><!-- 34 pre.display { font-family:inherit } 35 pre.format { font-family:inherit } 36 pre.smalldisplay { font-family:inherit; font-size:smaller } 37 pre.smallformat { font-family:inherit; font-size:smaller } 38 pre.smallexample { font-size:smaller } 39 pre.smalllisp { font-size:smaller } 40 span.sc { font-variant:small-caps } 41 span.roman { font-family:serif; font-weight:normal; } 42 span.sansserif { font-family:sans-serif; font-weight:normal; } 43--></style> 44<link rel="stylesheet" type="text/css" href="../cs.css"> 45</head> 46<body> 47<div class="node"> 48<a name="Optimize-Options"></a> 49<p> 50Next: <a rel="next" accesskey="n" href="Preprocessor-Options.html#Preprocessor-Options">Preprocessor Options</a>, 51Previous: <a rel="previous" accesskey="p" href="Debugging-Options.html#Debugging-Options">Debugging Options</a>, 52Up: <a rel="up" accesskey="u" href="Invoking-GCC.html#Invoking-GCC">Invoking GCC</a> 53<hr> 54</div> 55 56<h3 class="section">3.10 Options That Control Optimization</h3> 57 58<p><a name="index-optimize-options-729"></a><a name="index-options_002c-optimization-730"></a> 59These options control various sorts of optimizations. 60 61 <p>Without any optimization option, the compiler's goal is to reduce the 62cost of compilation and to make debugging produce the expected 63results. Statements are independent: if you stop the program with a 64breakpoint between statements, you can then assign a new value to any 65variable or change the program counter to any other statement in the 66function and get exactly the results you expect from the source 67code. 68 69 <p>Turning on optimization flags makes the compiler attempt to improve 70the performance and/or code size at the expense of compilation time 71and possibly the ability to debug the program. 72 73 <p>The compiler performs optimization based on the knowledge it has of the 74program. Compiling multiple files at once to a single output file mode allows 75the compiler to use information gained from all of the files when compiling 76each of them. 77 78 <p>Not all optimizations are controlled directly by a flag. Only 79optimizations that have a flag are listed in this section. 80 81 <p>Most optimizations are only enabled if an <samp><span class="option">-O</span></samp> level is set on 82the command line. Otherwise they are disabled, even if individual 83optimization flags are specified. 84 85 <p>Depending on the target and how GCC was configured, a slightly different 86set of optimizations may be enabled at each <samp><span class="option">-O</span></samp> level than 87those listed here. You can invoke GCC with <samp><span class="option">-Q --help=optimizers</span></samp> 88to find out the exact set of optimizations that are enabled at each level. 89See <a href="Overall-Options.html#Overall-Options">Overall Options</a>, for examples. 90 91 <dl> 92<dt><code>-O</code><dt><code>-O1</code><dd><a name="index-O-731"></a><a name="index-O1-732"></a>Optimize. Optimizing compilation takes somewhat more time, and a lot 93more memory for a large function. 94 95 <p>With <samp><span class="option">-O</span></samp>, the compiler tries to reduce code size and execution 96time, without performing any optimizations that take a great deal of 97compilation time. 98 99 <p><samp><span class="option">-O</span></samp> turns on the following optimization flags: 100 <pre class="smallexample"> -fauto-inc-dec 101 -fcompare-elim 102 -fcprop-registers 103 -fdce 104 -fdefer-pop 105 -fdelayed-branch 106 -fdse 107 -fguess-branch-probability 108 -fif-conversion2 109 -fif-conversion 110 -fipa-pure-const 111 -fipa-profile 112 -fipa-reference 113 -fmerge-constants 114 -fsplit-wide-types 115 -ftree-bit-ccp 116 -ftree-builtin-call-dce 117 -ftree-ccp 118 -ftree-ch 119 -ftree-copyrename 120 -ftree-dce 121 -ftree-dominator-opts 122 -ftree-dse 123 -ftree-forwprop 124 -ftree-fre 125 -ftree-phiprop 126 -ftree-slsr 127 -ftree-sra 128 -ftree-pta 129 -ftree-ter 130 -funit-at-a-time 131</pre> 132 <p><samp><span class="option">-O</span></samp> also turns on <samp><span class="option">-fomit-frame-pointer</span></samp> on machines 133where doing so does not interfere with debugging. 134 135 <br><dt><code>-O2</code><dd><a name="index-O2-733"></a>Optimize even more. GCC performs nearly all supported optimizations 136that do not involve a space-speed tradeoff. 137As compared to <samp><span class="option">-O</span></samp>, this option increases both compilation time 138and the performance of the generated code. 139 140 <p><samp><span class="option">-O2</span></samp> turns on all optimization flags specified by <samp><span class="option">-O</span></samp>. It 141also turns on the following optimization flags: 142 <pre class="smallexample"> -fthread-jumps 143 -falign-functions -falign-jumps 144 -falign-loops -falign-labels 145 -fcaller-saves 146 -fcrossjumping 147 -fcse-follow-jumps -fcse-skip-blocks 148 -fdelete-null-pointer-checks 149 -fdevirtualize 150 -fexpensive-optimizations 151 -fgcse -fgcse-lm 152 -fhoist-adjacent-loads 153 -finline-small-functions 154 -findirect-inlining 155 -fipa-sra 156 -foptimize-sibling-calls 157 -fpartial-inlining 158 -fpeephole2 159 -fregmove 160 -freorder-blocks -freorder-functions 161 -frerun-cse-after-loop 162 -fsched-interblock -fsched-spec 163 -fschedule-insns -fschedule-insns2 164 -fstrict-aliasing -fstrict-overflow 165 -ftree-switch-conversion -ftree-tail-merge 166 -ftree-pre 167 -ftree-vrp 168</pre> 169 <p>Please note the warning under <samp><span class="option">-fgcse</span></samp> about 170invoking <samp><span class="option">-O2</span></samp> on programs that use computed gotos. 171 172 <br><dt><code>-O3</code><dd><a name="index-O3-734"></a>Optimize yet more. <samp><span class="option">-O3</span></samp> turns on all optimizations specified 173by <samp><span class="option">-O2</span></samp> and also turns on the <samp><span class="option">-finline-functions</span></samp>, 174<samp><span class="option">-funswitch-loops</span></samp>, <samp><span class="option">-fpredictive-commoning</span></samp>, 175<samp><span class="option">-fgcse-after-reload</span></samp>, <samp><span class="option">-ftree-vectorize</span></samp>, 176<samp><span class="option">-fvect-cost-model</span></samp>, 177<samp><span class="option">-ftree-partial-pre</span></samp> and <samp><span class="option">-fipa-cp-clone</span></samp> options. 178 179 <br><dt><code>-O0</code><dd><a name="index-O0-735"></a>Reduce compilation time and make debugging produce the expected 180results. This is the default. 181 182 <br><dt><code>-Os</code><dd><a name="index-Os-736"></a>Optimize for size. <samp><span class="option">-Os</span></samp> enables all <samp><span class="option">-O2</span></samp> optimizations that 183do not typically increase code size. It also performs further 184optimizations designed to reduce code size. 185 186 <p><samp><span class="option">-Os</span></samp> disables the following optimization flags: 187 <pre class="smallexample"> -falign-functions -falign-jumps -falign-loops 188 -falign-labels -freorder-blocks -freorder-blocks-and-partition 189 -fprefetch-loop-arrays -ftree-vect-loop-version 190</pre> 191 <br><dt><code>-Ofast</code><dd><a name="index-Ofast-737"></a>Disregard strict standards compliance. <samp><span class="option">-Ofast</span></samp> enables all 192<samp><span class="option">-O3</span></samp> optimizations. It also enables optimizations that are not 193valid for all standard-compliant programs. 194It turns on <samp><span class="option">-ffast-math</span></samp> and the Fortran-specific 195<samp><span class="option">-fno-protect-parens</span></samp> and <samp><span class="option">-fstack-arrays</span></samp>. 196 197 <br><dt><code>-Og</code><dd><a name="index-Og-738"></a>Optimize debugging experience. <samp><span class="option">-Og</span></samp> enables optimizations 198that do not interfere with debugging. It should be the optimization 199level of choice for the standard edit-compile-debug cycle, offering 200a reasonable level of optimization while maintaining fast compilation 201and a good debugging experience. 202 203 <p>If you use multiple <samp><span class="option">-O</span></samp> options, with or without level numbers, 204the last such option is the one that is effective. 205</dl> 206 207 <p>Options of the form <samp><span class="option">-f</span><var>flag</var></samp> specify machine-independent 208flags. Most flags have both positive and negative forms; the negative 209form of <samp><span class="option">-ffoo</span></samp> is <samp><span class="option">-fno-foo</span></samp>. In the table 210below, only one of the forms is listed—the one you typically 211use. You can figure out the other form by either removing ‘<samp><span class="samp">no-</span></samp>’ 212or adding it. 213 214 <p>The following options control specific optimizations. They are either 215activated by <samp><span class="option">-O</span></samp> options or are related to ones that are. You 216can use the following flags in the rare cases when “fine-tuning” of 217optimizations to be performed is desired. 218 219 <dl> 220<dt><code>-fno-default-inline</code><dd><a name="index-fno_002ddefault_002dinline-739"></a>Do not make member functions inline by default merely because they are 221defined inside the class scope (C++ only). Otherwise, when you specify 222<samp><span class="option">-O</span></samp><!-- /@w -->, member functions defined inside class scope are compiled 223inline by default; i.e., you don't need to add ‘<samp><span class="samp">inline</span></samp>’ in front of 224the member function name. 225 226 <br><dt><code>-fno-defer-pop</code><dd><a name="index-fno_002ddefer_002dpop-740"></a>Always pop the arguments to each function call as soon as that function 227returns. For machines that must pop arguments after a function call, 228the compiler normally lets arguments accumulate on the stack for several 229function calls and pops them all at once. 230 231 <p>Disabled at levels <samp><span class="option">-O</span></samp>, <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 232 233 <br><dt><code>-fforward-propagate</code><dd><a name="index-fforward_002dpropagate-741"></a>Perform a forward propagation pass on RTL. The pass tries to combine two 234instructions and checks if the result can be simplified. If loop unrolling 235is active, two passes are performed and the second is scheduled after 236loop unrolling. 237 238 <p>This option is enabled by default at optimization levels <samp><span class="option">-O</span></samp>, 239<samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 240 241 <br><dt><code>-ffp-contract=</code><var>style</var><dd><a name="index-ffp_002dcontract-742"></a><samp><span class="option">-ffp-contract=off</span></samp> disables floating-point expression contraction. 242<samp><span class="option">-ffp-contract=fast</span></samp> enables floating-point expression contraction 243such as forming of fused multiply-add operations if the target has 244native support for them. 245<samp><span class="option">-ffp-contract=on</span></samp> enables floating-point expression contraction 246if allowed by the language standard. This is currently not implemented 247and treated equal to <samp><span class="option">-ffp-contract=off</span></samp>. 248 249 <p>The default is <samp><span class="option">-ffp-contract=fast</span></samp>. 250 251 <br><dt><code>-fomit-frame-pointer</code><dd><a name="index-fomit_002dframe_002dpointer-743"></a>Don't keep the frame pointer in a register for functions that 252don't need one. This avoids the instructions to save, set up and 253restore frame pointers; it also makes an extra register available 254in many functions. <strong>It also makes debugging impossible on 255some machines.</strong> 256 257 <p>On some machines, such as the VAX, this flag has no effect, because 258the standard calling sequence automatically handles the frame pointer 259and nothing is saved by pretending it doesn't exist. The 260machine-description macro <code>FRAME_POINTER_REQUIRED</code> controls 261whether a target machine supports this flag. See <a href="../gccint/Registers.html#Registers">Register Usage</a>. 262 263 <p>Starting with GCC version 4.6, the default setting (when not optimizing for 264size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets has been changed to 265<samp><span class="option">-fomit-frame-pointer</span></samp>. The default can be reverted to 266<samp><span class="option">-fno-omit-frame-pointer</span></samp> by configuring GCC with the 267<samp><span class="option">--enable-frame-pointer</span></samp> configure option. 268 269 <p>Enabled at levels <samp><span class="option">-O</span></samp>, <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 270 271 <br><dt><code>-foptimize-sibling-calls</code><dd><a name="index-foptimize_002dsibling_002dcalls-744"></a>Optimize sibling and tail recursive calls. 272 273 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 274 275 <br><dt><code>-fno-inline</code><dd><a name="index-fno_002dinline-745"></a>Do not expand any functions inline apart from those marked with 276the <code>always_inline</code> attribute. This is the default when not 277optimizing. 278 279 <p>Single functions can be exempted from inlining by marking them 280with the <code>noinline</code> attribute. 281 282 <br><dt><code>-finline-small-functions</code><dd><a name="index-finline_002dsmall_002dfunctions-746"></a>Integrate functions into their callers when their body is smaller than expected 283function call code (so overall size of program gets smaller). The compiler 284heuristically decides which functions are simple enough to be worth integrating 285in this way. This inlining applies to all functions, even those not declared 286inline. 287 288 <p>Enabled at level <samp><span class="option">-O2</span></samp>. 289 290 <br><dt><code>-findirect-inlining</code><dd><a name="index-findirect_002dinlining-747"></a>Inline also indirect calls that are discovered to be known at compile 291time thanks to previous inlining. This option has any effect only 292when inlining itself is turned on by the <samp><span class="option">-finline-functions</span></samp> 293or <samp><span class="option">-finline-small-functions</span></samp> options. 294 295 <p>Enabled at level <samp><span class="option">-O2</span></samp>. 296 297 <br><dt><code>-finline-functions</code><dd><a name="index-finline_002dfunctions-748"></a>Consider all functions for inlining, even if they are not declared inline. 298The compiler heuristically decides which functions are worth integrating 299in this way. 300 301 <p>If all calls to a given function are integrated, and the function is 302declared <code>static</code>, then the function is normally not output as 303assembler code in its own right. 304 305 <p>Enabled at level <samp><span class="option">-O3</span></samp>. 306 307 <br><dt><code>-finline-functions-called-once</code><dd><a name="index-finline_002dfunctions_002dcalled_002donce-749"></a>Consider all <code>static</code> functions called once for inlining into their 308caller even if they are not marked <code>inline</code>. If a call to a given 309function is integrated, then the function is not output as assembler code 310in its own right. 311 312 <p>Enabled at levels <samp><span class="option">-O1</span></samp>, <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp> and <samp><span class="option">-Os</span></samp>. 313 314 <br><dt><code>-fearly-inlining</code><dd><a name="index-fearly_002dinlining-750"></a>Inline functions marked by <code>always_inline</code> and functions whose body seems 315smaller than the function call overhead early before doing 316<samp><span class="option">-fprofile-generate</span></samp> instrumentation and real inlining pass. Doing so 317makes profiling significantly cheaper and usually inlining faster on programs 318having large chains of nested wrapper functions. 319 320 <p>Enabled by default. 321 322 <br><dt><code>-fipa-sra</code><dd><a name="index-fipa_002dsra-751"></a>Perform interprocedural scalar replacement of aggregates, removal of 323unused parameters and replacement of parameters passed by reference 324by parameters passed by value. 325 326 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp> and <samp><span class="option">-Os</span></samp>. 327 328 <br><dt><code>-finline-limit=</code><var>n</var><dd><a name="index-finline_002dlimit-752"></a>By default, GCC limits the size of functions that can be inlined. This flag 329allows coarse control of this limit. <var>n</var> is the size of functions that 330can be inlined in number of pseudo instructions. 331 332 <p>Inlining is actually controlled by a number of parameters, which may be 333specified individually by using <samp><span class="option">--param </span><var>name</var><span class="option">=</span><var>value</var></samp>. 334The <samp><span class="option">-finline-limit=</span><var>n</var></samp> option sets some of these parameters 335as follows: 336 337 <dl> 338<dt><code>max-inline-insns-single</code><dd>is set to <var>n</var>/2. 339<br><dt><code>max-inline-insns-auto</code><dd>is set to <var>n</var>/2. 340</dl> 341 342 <p>See below for a documentation of the individual 343parameters controlling inlining and for the defaults of these parameters. 344 345 <p><em>Note:</em> there may be no value to <samp><span class="option">-finline-limit</span></samp> that results 346in default behavior. 347 348 <p><em>Note:</em> pseudo instruction represents, in this particular context, an 349abstract measurement of function's size. In no way does it represent a count 350of assembly instructions and as such its exact meaning might change from one 351release to an another. 352 353 <br><dt><code>-fno-keep-inline-dllexport</code><dd><a name="index-g_t_002dfno_002dkeep_002dinline_002ddllexport-753"></a>This is a more fine-grained version of <samp><span class="option">-fkeep-inline-functions</span></samp>, 354which applies only to functions that are declared using the <code>dllexport</code> 355attribute or declspec (See <a href="Function-Attributes.html#Function-Attributes">Declaring Attributes of Functions</a>.) 356 357 <br><dt><code>-fkeep-inline-functions</code><dd><a name="index-fkeep_002dinline_002dfunctions-754"></a>In C, emit <code>static</code> functions that are declared <code>inline</code> 358into the object file, even if the function has been inlined into all 359of its callers. This switch does not affect functions using the 360<code>extern inline</code> extension in GNU C90. In C++, emit any and all 361inline functions into the object file. 362 363 <br><dt><code>-fkeep-static-consts</code><dd><a name="index-fkeep_002dstatic_002dconsts-755"></a>Emit variables declared <code>static const</code> when optimization isn't turned 364on, even if the variables aren't referenced. 365 366 <p>GCC enables this option by default. If you want to force the compiler to 367check if a variable is referenced, regardless of whether or not 368optimization is turned on, use the <samp><span class="option">-fno-keep-static-consts</span></samp> option. 369 370 <br><dt><code>-fmerge-constants</code><dd><a name="index-fmerge_002dconstants-756"></a>Attempt to merge identical constants (string constants and floating-point 371constants) across compilation units. 372 373 <p>This option is the default for optimized compilation if the assembler and 374linker support it. Use <samp><span class="option">-fno-merge-constants</span></samp> to inhibit this 375behavior. 376 377 <p>Enabled at levels <samp><span class="option">-O</span></samp>, <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 378 379 <br><dt><code>-fmerge-all-constants</code><dd><a name="index-fmerge_002dall_002dconstants-757"></a>Attempt to merge identical constants and identical variables. 380 381 <p>This option implies <samp><span class="option">-fmerge-constants</span></samp>. In addition to 382<samp><span class="option">-fmerge-constants</span></samp> this considers e.g. even constant initialized 383arrays or initialized constant variables with integral or floating-point 384types. Languages like C or C++ require each variable, including multiple 385instances of the same variable in recursive calls, to have distinct locations, 386so using this option results in non-conforming 387behavior. 388 389 <br><dt><code>-fmodulo-sched</code><dd><a name="index-fmodulo_002dsched-758"></a>Perform swing modulo scheduling immediately before the first scheduling 390pass. This pass looks at innermost loops and reorders their 391instructions by overlapping different iterations. 392 393 <br><dt><code>-fmodulo-sched-allow-regmoves</code><dd><a name="index-fmodulo_002dsched_002dallow_002dregmoves-759"></a>Perform more aggressive SMS-based modulo scheduling with register moves 394allowed. By setting this flag certain anti-dependences edges are 395deleted, which triggers the generation of reg-moves based on the 396life-range analysis. This option is effective only with 397<samp><span class="option">-fmodulo-sched</span></samp> enabled. 398 399 <br><dt><code>-fno-branch-count-reg</code><dd><a name="index-fno_002dbranch_002dcount_002dreg-760"></a>Do not use “decrement and branch” instructions on a count register, 400but instead generate a sequence of instructions that decrement a 401register, compare it against zero, then branch based upon the result. 402This option is only meaningful on architectures that support such 403instructions, which include x86, PowerPC, IA-64 and S/390. 404 405 <p>The default is <samp><span class="option">-fbranch-count-reg</span></samp>. 406 407 <br><dt><code>-fno-function-cse</code><dd><a name="index-fno_002dfunction_002dcse-761"></a>Do not put function addresses in registers; make each instruction that 408calls a constant function contain the function's address explicitly. 409 410 <p>This option results in less efficient code, but some strange hacks 411that alter the assembler output may be confused by the optimizations 412performed when this option is not used. 413 414 <p>The default is <samp><span class="option">-ffunction-cse</span></samp> 415 416 <br><dt><code>-fno-zero-initialized-in-bss</code><dd><a name="index-fno_002dzero_002dinitialized_002din_002dbss-762"></a>If the target supports a BSS section, GCC by default puts variables that 417are initialized to zero into BSS. This can save space in the resulting 418code. 419 420 <p>This option turns off this behavior because some programs explicitly 421rely on variables going to the data section—e.g., so that the 422resulting executable can find the beginning of that section and/or make 423assumptions based on that. 424 425 <p>The default is <samp><span class="option">-fzero-initialized-in-bss</span></samp>. 426 427 <br><dt><code>-fmudflap -fmudflapth -fmudflapir</code><dd><a name="index-fmudflap-763"></a><a name="index-fmudflapth-764"></a><a name="index-fmudflapir-765"></a><a name="index-bounds-checking-766"></a><a name="index-mudflap-767"></a>For front-ends that support it (C and C++), instrument all risky 428pointer/array dereferencing operations, some standard library 429string/heap functions, and some other associated constructs with 430range/validity tests. Modules so instrumented should be immune to 431buffer overflows, invalid heap use, and some other classes of C/C++ 432programming errors. The instrumentation relies on a separate runtime 433library (<samp><span class="file">libmudflap</span></samp>), which is linked into a program if 434<samp><span class="option">-fmudflap</span></samp> is given at link time. Run-time behavior of the 435instrumented program is controlled by the <samp><span class="env">MUDFLAP_OPTIONS</span></samp> 436environment variable. See <code>env MUDFLAP_OPTIONS=-help a.out</code> 437for its options. 438 439 <p>Use <samp><span class="option">-fmudflapth</span></samp> instead of <samp><span class="option">-fmudflap</span></samp> to compile and to 440link if your program is multi-threaded. Use <samp><span class="option">-fmudflapir</span></samp>, in 441addition to <samp><span class="option">-fmudflap</span></samp> or <samp><span class="option">-fmudflapth</span></samp>, if 442instrumentation should ignore pointer reads. This produces less 443instrumentation (and therefore faster execution) and still provides 444some protection against outright memory corrupting writes, but allows 445erroneously read data to propagate within a program. 446 447 <br><dt><code>-fthread-jumps</code><dd><a name="index-fthread_002djumps-768"></a>Perform optimizations that check to see if a jump branches to a 448location where another comparison subsumed by the first is found. If 449so, the first branch is redirected to either the destination of the 450second branch or a point immediately following it, depending on whether 451the condition is known to be true or false. 452 453 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 454 455 <br><dt><code>-fsplit-wide-types</code><dd><a name="index-fsplit_002dwide_002dtypes-769"></a>When using a type that occupies multiple registers, such as <code>long 456long</code> on a 32-bit system, split the registers apart and allocate them 457independently. This normally generates better code for those types, 458but may make debugging more difficult. 459 460 <p>Enabled at levels <samp><span class="option">-O</span></samp>, <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, 461<samp><span class="option">-Os</span></samp>. 462 463 <br><dt><code>-fcse-follow-jumps</code><dd><a name="index-fcse_002dfollow_002djumps-770"></a>In common subexpression elimination (CSE), scan through jump instructions 464when the target of the jump is not reached by any other path. For 465example, when CSE encounters an <code>if</code> statement with an 466<code>else</code> clause, CSE follows the jump when the condition 467tested is false. 468 469 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 470 471 <br><dt><code>-fcse-skip-blocks</code><dd><a name="index-fcse_002dskip_002dblocks-771"></a>This is similar to <samp><span class="option">-fcse-follow-jumps</span></samp>, but causes CSE to 472follow jumps that conditionally skip over blocks. When CSE 473encounters a simple <code>if</code> statement with no else clause, 474<samp><span class="option">-fcse-skip-blocks</span></samp> causes CSE to follow the jump around the 475body of the <code>if</code>. 476 477 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 478 479 <br><dt><code>-frerun-cse-after-loop</code><dd><a name="index-frerun_002dcse_002dafter_002dloop-772"></a>Re-run common subexpression elimination after loop optimizations are 480performed. 481 482 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 483 484 <br><dt><code>-fgcse</code><dd><a name="index-fgcse-773"></a>Perform a global common subexpression elimination pass. 485This pass also performs global constant and copy propagation. 486 487 <p><em>Note:</em> When compiling a program using computed gotos, a GCC 488extension, you may get better run-time performance if you disable 489the global common subexpression elimination pass by adding 490<samp><span class="option">-fno-gcse</span></samp> to the command line. 491 492 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 493 494 <br><dt><code>-fgcse-lm</code><dd><a name="index-fgcse_002dlm-774"></a>When <samp><span class="option">-fgcse-lm</span></samp> is enabled, global common subexpression elimination 495attempts to move loads that are only killed by stores into themselves. This 496allows a loop containing a load/store sequence to be changed to a load outside 497the loop, and a copy/store within the loop. 498 499 <p>Enabled by default when <samp><span class="option">-fgcse</span></samp> is enabled. 500 501 <br><dt><code>-fgcse-sm</code><dd><a name="index-fgcse_002dsm-775"></a>When <samp><span class="option">-fgcse-sm</span></samp> is enabled, a store motion pass is run after 502global common subexpression elimination. This pass attempts to move 503stores out of loops. When used in conjunction with <samp><span class="option">-fgcse-lm</span></samp>, 504loops containing a load/store sequence can be changed to a load before 505the loop and a store after the loop. 506 507 <p>Not enabled at any optimization level. 508 509 <br><dt><code>-fgcse-las</code><dd><a name="index-fgcse_002dlas-776"></a>When <samp><span class="option">-fgcse-las</span></samp> is enabled, the global common subexpression 510elimination pass eliminates redundant loads that come after stores to the 511same memory location (both partial and full redundancies). 512 513 <p>Not enabled at any optimization level. 514 515 <br><dt><code>-fgcse-after-reload</code><dd><a name="index-fgcse_002dafter_002dreload-777"></a>When <samp><span class="option">-fgcse-after-reload</span></samp> is enabled, a redundant load elimination 516pass is performed after reload. The purpose of this pass is to clean up 517redundant spilling. 518 519 <br><dt><code>-faggressive-loop-optimizations</code><dd><a name="index-faggressive_002dloop_002doptimizations-778"></a>This option tells the loop optimizer to use language constraints to 520derive bounds for the number of iterations of a loop. This assumes that 521loop code does not invoke undefined behavior by for example causing signed 522integer overflows or out-of-bound array accesses. The bounds for the 523number of iterations of a loop are used to guide loop unrolling and peeling 524and loop exit test optimizations. 525This option is enabled by default. 526 527 <br><dt><code>-funsafe-loop-optimizations</code><dd><a name="index-funsafe_002dloop_002doptimizations-779"></a>This option tells the loop optimizer to assume that loop indices do not 528overflow, and that loops with nontrivial exit condition are not 529infinite. This enables a wider range of loop optimizations even if 530the loop optimizer itself cannot prove that these assumptions are valid. 531If you use <samp><span class="option">-Wunsafe-loop-optimizations</span></samp>, the compiler warns you 532if it finds this kind of loop. 533 534 <br><dt><code>-fcrossjumping</code><dd><a name="index-fcrossjumping-780"></a>Perform cross-jumping transformation. 535This transformation unifies equivalent code and saves code size. The 536resulting code may or may not perform better than without cross-jumping. 537 538 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 539 540 <br><dt><code>-fauto-inc-dec</code><dd><a name="index-fauto_002dinc_002ddec-781"></a>Combine increments or decrements of addresses with memory accesses. 541This pass is always skipped on architectures that do not have 542instructions to support this. Enabled by default at <samp><span class="option">-O</span></samp> and 543higher on architectures that support this. 544 545 <br><dt><code>-fdce</code><dd><a name="index-fdce-782"></a>Perform dead code elimination (DCE) on RTL. 546Enabled by default at <samp><span class="option">-O</span></samp> and higher. 547 548 <br><dt><code>-fdse</code><dd><a name="index-fdse-783"></a>Perform dead store elimination (DSE) on RTL. 549Enabled by default at <samp><span class="option">-O</span></samp> and higher. 550 551 <br><dt><code>-fif-conversion</code><dd><a name="index-fif_002dconversion-784"></a>Attempt to transform conditional jumps into branch-less equivalents. This 552includes use of conditional moves, min, max, set flags and abs instructions, and 553some tricks doable by standard arithmetics. The use of conditional execution 554on chips where it is available is controlled by <code>if-conversion2</code>. 555 556 <p>Enabled at levels <samp><span class="option">-O</span></samp>, <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 557 558 <br><dt><code>-fif-conversion2</code><dd><a name="index-fif_002dconversion2-785"></a>Use conditional execution (where available) to transform conditional jumps into 559branch-less equivalents. 560 561 <p>Enabled at levels <samp><span class="option">-O</span></samp>, <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 562 563 <br><dt><code>-fdelete-null-pointer-checks</code><dd><a name="index-fdelete_002dnull_002dpointer_002dchecks-786"></a>Assume that programs cannot safely dereference null pointers, and that 564no code or data element resides there. This enables simple constant 565folding optimizations at all optimization levels. In addition, other 566optimization passes in GCC use this flag to control global dataflow 567analyses that eliminate useless checks for null pointers; these assume 568that if a pointer is checked after it has already been dereferenced, 569it cannot be null. 570 571 <p>Note however that in some environments this assumption is not true. 572Use <samp><span class="option">-fno-delete-null-pointer-checks</span></samp> to disable this optimization 573for programs that depend on that behavior. 574 575 <p>Some targets, especially embedded ones, disable this option at all levels. 576Otherwise it is enabled at all levels: <samp><span class="option">-O0</span></samp>, <samp><span class="option">-O1</span></samp>, 577<samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. Passes that use the information 578are enabled independently at different optimization levels. 579 580 <br><dt><code>-fdevirtualize</code><dd><a name="index-fdevirtualize-787"></a>Attempt to convert calls to virtual functions to direct calls. This 581is done both within a procedure and interprocedurally as part of 582indirect inlining (<code>-findirect-inlining</code>) and interprocedural constant 583propagation (<samp><span class="option">-fipa-cp</span></samp>). 584Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 585 586 <br><dt><code>-fexpensive-optimizations</code><dd><a name="index-fexpensive_002doptimizations-788"></a>Perform a number of minor optimizations that are relatively expensive. 587 588 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 589 590 <br><dt><code>-free</code><dd><a name="index-free-789"></a>Attempt to remove redundant extension instructions. This is especially 591helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit 592registers after writing to their lower 32-bit half. 593 594 <p>Enabled for x86 at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>. 595 596 <br><dt><code>-foptimize-register-move</code><dt><code>-fregmove</code><dd><a name="index-foptimize_002dregister_002dmove-790"></a><a name="index-fregmove-791"></a>Attempt to reassign register numbers in move instructions and as 597operands of other simple instructions in order to maximize the amount of 598register tying. This is especially helpful on machines with two-operand 599instructions. 600 601 <p>Note <samp><span class="option">-fregmove</span></samp> and <samp><span class="option">-foptimize-register-move</span></samp> are the same 602optimization. 603 604 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 605 606 <br><dt><code>-fira-algorithm=</code><var>algorithm</var><dd>Use the specified coloring algorithm for the integrated register 607allocator. The <var>algorithm</var> argument can be ‘<samp><span class="samp">priority</span></samp>’, which 608specifies Chow's priority coloring, or ‘<samp><span class="samp">CB</span></samp>’, which specifies 609Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented 610for all architectures, but for those targets that do support it, it is 611the default because it generates better code. 612 613 <br><dt><code>-fira-region=</code><var>region</var><dd>Use specified regions for the integrated register allocator. The 614<var>region</var> argument should be one of the following: 615 616 <dl> 617<dt>‘<samp><span class="samp">all</span></samp>’<dd>Use all loops as register allocation regions. 618This can give the best results for machines with a small and/or 619irregular register set. 620 621 <br><dt>‘<samp><span class="samp">mixed</span></samp>’<dd>Use all loops except for loops with small register pressure 622as the regions. This value usually gives 623the best results in most cases and for most architectures, 624and is enabled by default when compiling with optimization for speed 625(<samp><span class="option">-O</span></samp>, <samp><span class="option">-O2</span></samp>, <small class="dots">...</small>). 626 627 <br><dt>‘<samp><span class="samp">one</span></samp>’<dd>Use all functions as a single region. 628This typically results in the smallest code size, and is enabled by default for 629<samp><span class="option">-Os</span></samp> or <samp><span class="option">-O0</span></samp>. 630 631 </dl> 632 633 <br><dt><code>-fira-hoist-pressure</code><dd><a name="index-fira_002dhoist_002dpressure-792"></a>Use IRA to evaluate register pressure in the code hoisting pass for 634decisions to hoist expressions. This option usually results in smaller 635code, but it can slow the compiler down. 636 637 <p>This option is enabled at level <samp><span class="option">-Os</span></samp> for all targets. 638 639 <br><dt><code>-fira-loop-pressure</code><dd><a name="index-fira_002dloop_002dpressure-793"></a>Use IRA to evaluate register pressure in loops for decisions to move 640loop invariants. This option usually results in generation 641of faster and smaller code on machines with large register files (>= 32 642registers), but it can slow the compiler down. 643 644 <p>This option is enabled at level <samp><span class="option">-O3</span></samp> for some targets. 645 646 <br><dt><code>-fno-ira-share-save-slots</code><dd><a name="index-fno_002dira_002dshare_002dsave_002dslots-794"></a>Disable sharing of stack slots used for saving call-used hard 647registers living through a call. Each hard register gets a 648separate stack slot, and as a result function stack frames are 649larger. 650 651 <br><dt><code>-fno-ira-share-spill-slots</code><dd><a name="index-fno_002dira_002dshare_002dspill_002dslots-795"></a>Disable sharing of stack slots allocated for pseudo-registers. Each 652pseudo-register that does not get a hard register gets a separate 653stack slot, and as a result function stack frames are larger. 654 655 <br><dt><code>-fira-verbose=</code><var>n</var><dd><a name="index-fira_002dverbose-796"></a>Control the verbosity of the dump file for the integrated register allocator. 656The default value is 5. If the value <var>n</var> is greater or equal to 10, 657the dump output is sent to stderr using the same format as <var>n</var> minus 10. 658 659 <br><dt><code>-fdelayed-branch</code><dd><a name="index-fdelayed_002dbranch-797"></a>If supported for the target machine, attempt to reorder instructions 660to exploit instruction slots available after delayed branch 661instructions. 662 663 <p>Enabled at levels <samp><span class="option">-O</span></samp>, <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 664 665 <br><dt><code>-fschedule-insns</code><dd><a name="index-fschedule_002dinsns-798"></a>If supported for the target machine, attempt to reorder instructions to 666eliminate execution stalls due to required data being unavailable. This 667helps machines that have slow floating point or memory load instructions 668by allowing other instructions to be issued until the result of the load 669or floating-point instruction is required. 670 671 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>. 672 673 <br><dt><code>-fschedule-insns2</code><dd><a name="index-fschedule_002dinsns2-799"></a>Similar to <samp><span class="option">-fschedule-insns</span></samp>, but requests an additional pass of 674instruction scheduling after register allocation has been done. This is 675especially useful on machines with a relatively small number of 676registers and where memory load instructions take more than one cycle. 677 678 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 679 680 <br><dt><code>-fno-sched-interblock</code><dd><a name="index-fno_002dsched_002dinterblock-800"></a>Don't schedule instructions across basic blocks. This is normally 681enabled by default when scheduling before register allocation, i.e. 682with <samp><span class="option">-fschedule-insns</span></samp> or at <samp><span class="option">-O2</span></samp> or higher. 683 684 <br><dt><code>-fno-sched-spec</code><dd><a name="index-fno_002dsched_002dspec-801"></a>Don't allow speculative motion of non-load instructions. This is normally 685enabled by default when scheduling before register allocation, i.e. 686with <samp><span class="option">-fschedule-insns</span></samp> or at <samp><span class="option">-O2</span></samp> or higher. 687 688 <br><dt><code>-fsched-pressure</code><dd><a name="index-fsched_002dpressure-802"></a>Enable register pressure sensitive insn scheduling before register 689allocation. This only makes sense when scheduling before register 690allocation is enabled, i.e. with <samp><span class="option">-fschedule-insns</span></samp> or at 691<samp><span class="option">-O2</span></samp> or higher. Usage of this option can improve the 692generated code and decrease its size by preventing register pressure 693increase above the number of available hard registers and subsequent 694spills in register allocation. 695 696 <br><dt><code>-fsched-spec-load</code><dd><a name="index-fsched_002dspec_002dload-803"></a>Allow speculative motion of some load instructions. This only makes 697sense when scheduling before register allocation, i.e. with 698<samp><span class="option">-fschedule-insns</span></samp> or at <samp><span class="option">-O2</span></samp> or higher. 699 700 <br><dt><code>-fsched-spec-load-dangerous</code><dd><a name="index-fsched_002dspec_002dload_002ddangerous-804"></a>Allow speculative motion of more load instructions. This only makes 701sense when scheduling before register allocation, i.e. with 702<samp><span class="option">-fschedule-insns</span></samp> or at <samp><span class="option">-O2</span></samp> or higher. 703 704 <br><dt><code>-fsched-stalled-insns</code><dt><code>-fsched-stalled-insns=</code><var>n</var><dd><a name="index-fsched_002dstalled_002dinsns-805"></a>Define how many insns (if any) can be moved prematurely from the queue 705of stalled insns into the ready list during the second scheduling pass. 706<samp><span class="option">-fno-sched-stalled-insns</span></samp> means that no insns are moved 707prematurely, <samp><span class="option">-fsched-stalled-insns=0</span></samp> means there is no limit 708on how many queued insns can be moved prematurely. 709<samp><span class="option">-fsched-stalled-insns</span></samp> without a value is equivalent to 710<samp><span class="option">-fsched-stalled-insns=1</span></samp>. 711 712 <br><dt><code>-fsched-stalled-insns-dep</code><dt><code>-fsched-stalled-insns-dep=</code><var>n</var><dd><a name="index-fsched_002dstalled_002dinsns_002ddep-806"></a>Define how many insn groups (cycles) are examined for a dependency 713on a stalled insn that is a candidate for premature removal from the queue 714of stalled insns. This has an effect only during the second scheduling pass, 715and only if <samp><span class="option">-fsched-stalled-insns</span></samp> is used. 716<samp><span class="option">-fno-sched-stalled-insns-dep</span></samp> is equivalent to 717<samp><span class="option">-fsched-stalled-insns-dep=0</span></samp>. 718<samp><span class="option">-fsched-stalled-insns-dep</span></samp> without a value is equivalent to 719<samp><span class="option">-fsched-stalled-insns-dep=1</span></samp>. 720 721 <br><dt><code>-fsched2-use-superblocks</code><dd><a name="index-fsched2_002duse_002dsuperblocks-807"></a>When scheduling after register allocation, use superblock scheduling. 722This allows motion across basic block boundaries, 723resulting in faster schedules. This option is experimental, as not all machine 724descriptions used by GCC model the CPU closely enough to avoid unreliable 725results from the algorithm. 726 727 <p>This only makes sense when scheduling after register allocation, i.e. with 728<samp><span class="option">-fschedule-insns2</span></samp> or at <samp><span class="option">-O2</span></samp> or higher. 729 730 <br><dt><code>-fsched-group-heuristic</code><dd><a name="index-fsched_002dgroup_002dheuristic-808"></a>Enable the group heuristic in the scheduler. This heuristic favors 731the instruction that belongs to a schedule group. This is enabled 732by default when scheduling is enabled, i.e. with <samp><span class="option">-fschedule-insns</span></samp> 733or <samp><span class="option">-fschedule-insns2</span></samp> or at <samp><span class="option">-O2</span></samp> or higher. 734 735 <br><dt><code>-fsched-critical-path-heuristic</code><dd><a name="index-fsched_002dcritical_002dpath_002dheuristic-809"></a>Enable the critical-path heuristic in the scheduler. This heuristic favors 736instructions on the critical path. This is enabled by default when 737scheduling is enabled, i.e. with <samp><span class="option">-fschedule-insns</span></samp> 738or <samp><span class="option">-fschedule-insns2</span></samp> or at <samp><span class="option">-O2</span></samp> or higher. 739 740 <br><dt><code>-fsched-spec-insn-heuristic</code><dd><a name="index-fsched_002dspec_002dinsn_002dheuristic-810"></a>Enable the speculative instruction heuristic in the scheduler. This 741heuristic favors speculative instructions with greater dependency weakness. 742This is enabled by default when scheduling is enabled, i.e. 743with <samp><span class="option">-fschedule-insns</span></samp> or <samp><span class="option">-fschedule-insns2</span></samp> 744or at <samp><span class="option">-O2</span></samp> or higher. 745 746 <br><dt><code>-fsched-rank-heuristic</code><dd><a name="index-fsched_002drank_002dheuristic-811"></a>Enable the rank heuristic in the scheduler. This heuristic favors 747the instruction belonging to a basic block with greater size or frequency. 748This is enabled by default when scheduling is enabled, i.e. 749with <samp><span class="option">-fschedule-insns</span></samp> or <samp><span class="option">-fschedule-insns2</span></samp> or 750at <samp><span class="option">-O2</span></samp> or higher. 751 752 <br><dt><code>-fsched-last-insn-heuristic</code><dd><a name="index-fsched_002dlast_002dinsn_002dheuristic-812"></a>Enable the last-instruction heuristic in the scheduler. This heuristic 753favors the instruction that is less dependent on the last instruction 754scheduled. This is enabled by default when scheduling is enabled, 755i.e. with <samp><span class="option">-fschedule-insns</span></samp> or <samp><span class="option">-fschedule-insns2</span></samp> or 756at <samp><span class="option">-O2</span></samp> or higher. 757 758 <br><dt><code>-fsched-dep-count-heuristic</code><dd><a name="index-fsched_002ddep_002dcount_002dheuristic-813"></a>Enable the dependent-count heuristic in the scheduler. This heuristic 759favors the instruction that has more instructions depending on it. 760This is enabled by default when scheduling is enabled, i.e. 761with <samp><span class="option">-fschedule-insns</span></samp> or <samp><span class="option">-fschedule-insns2</span></samp> or 762at <samp><span class="option">-O2</span></samp> or higher. 763 764 <br><dt><code>-freschedule-modulo-scheduled-loops</code><dd><a name="index-freschedule_002dmodulo_002dscheduled_002dloops-814"></a>Modulo scheduling is performed before traditional scheduling. If a loop 765is modulo scheduled, later scheduling passes may change its schedule. 766Use this option to control that behavior. 767 768 <br><dt><code>-fselective-scheduling</code><dd><a name="index-fselective_002dscheduling-815"></a>Schedule instructions using selective scheduling algorithm. Selective 769scheduling runs instead of the first scheduler pass. 770 771 <br><dt><code>-fselective-scheduling2</code><dd><a name="index-fselective_002dscheduling2-816"></a>Schedule instructions using selective scheduling algorithm. Selective 772scheduling runs instead of the second scheduler pass. 773 774 <br><dt><code>-fsel-sched-pipelining</code><dd><a name="index-fsel_002dsched_002dpipelining-817"></a>Enable software pipelining of innermost loops during selective scheduling. 775This option has no effect unless one of <samp><span class="option">-fselective-scheduling</span></samp> or 776<samp><span class="option">-fselective-scheduling2</span></samp> is turned on. 777 778 <br><dt><code>-fsel-sched-pipelining-outer-loops</code><dd><a name="index-fsel_002dsched_002dpipelining_002douter_002dloops-818"></a>When pipelining loops during selective scheduling, also pipeline outer loops. 779This option has no effect unless <samp><span class="option">-fsel-sched-pipelining</span></samp> is turned on. 780 781 <br><dt><code>-fshrink-wrap</code><dd><a name="index-fshrink_002dwrap-819"></a>Emit function prologues only before parts of the function that need it, 782rather than at the top of the function. This flag is enabled by default at 783<samp><span class="option">-O</span></samp> and higher. 784 785 <br><dt><code>-fcaller-saves</code><dd><a name="index-fcaller_002dsaves-820"></a>Enable allocation of values to registers that are clobbered by 786function calls, by emitting extra instructions to save and restore the 787registers around such calls. Such allocation is done only when it 788seems to result in better code. 789 790 <p>This option is always enabled by default on certain machines, usually 791those which have no call-preserved registers to use instead. 792 793 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 794 795 <br><dt><code>-fcombine-stack-adjustments</code><dd><a name="index-fcombine_002dstack_002dadjustments-821"></a>Tracks stack adjustments (pushes and pops) and stack memory references 796and then tries to find ways to combine them. 797 798 <p>Enabled by default at <samp><span class="option">-O1</span></samp> and higher. 799 800 <br><dt><code>-fconserve-stack</code><dd><a name="index-fconserve_002dstack-822"></a>Attempt to minimize stack usage. The compiler attempts to use less 801stack space, even if that makes the program slower. This option 802implies setting the <samp><span class="option">large-stack-frame</span></samp> parameter to 100 803and the <samp><span class="option">large-stack-frame-growth</span></samp> parameter to 400. 804 805 <br><dt><code>-ftree-reassoc</code><dd><a name="index-ftree_002dreassoc-823"></a>Perform reassociation on trees. This flag is enabled by default 806at <samp><span class="option">-O</span></samp> and higher. 807 808 <br><dt><code>-ftree-pre</code><dd><a name="index-ftree_002dpre-824"></a>Perform partial redundancy elimination (PRE) on trees. This flag is 809enabled by default at <samp><span class="option">-O2</span></samp> and <samp><span class="option">-O3</span></samp>. 810 811 <br><dt><code>-ftree-partial-pre</code><dd><a name="index-ftree_002dpartial_002dpre-825"></a>Make partial redundancy elimination (PRE) more aggressive. This flag is 812enabled by default at <samp><span class="option">-O3</span></samp>. 813 814 <br><dt><code>-ftree-forwprop</code><dd><a name="index-ftree_002dforwprop-826"></a>Perform forward propagation on trees. This flag is enabled by default 815at <samp><span class="option">-O</span></samp> and higher. 816 817 <br><dt><code>-ftree-fre</code><dd><a name="index-ftree_002dfre-827"></a>Perform full redundancy elimination (FRE) on trees. The difference 818between FRE and PRE is that FRE only considers expressions 819that are computed on all paths leading to the redundant computation. 820This analysis is faster than PRE, though it exposes fewer redundancies. 821This flag is enabled by default at <samp><span class="option">-O</span></samp> and higher. 822 823 <br><dt><code>-ftree-phiprop</code><dd><a name="index-ftree_002dphiprop-828"></a>Perform hoisting of loads from conditional pointers on trees. This 824pass is enabled by default at <samp><span class="option">-O</span></samp> and higher. 825 826 <br><dt><code>-fhoist-adjacent-loads</code><dd><a name="index-hoist_002dadjacent_002dloads-829"></a>Speculatively hoist loads from both branches of an if-then-else if the 827loads are from adjacent locations in the same structure and the target 828architecture has a conditional move instruction. This flag is enabled 829by default at <samp><span class="option">-O2</span></samp> and higher. 830 831 <br><dt><code>-ftree-copy-prop</code><dd><a name="index-ftree_002dcopy_002dprop-830"></a>Perform copy propagation on trees. This pass eliminates unnecessary 832copy operations. This flag is enabled by default at <samp><span class="option">-O</span></samp> and 833higher. 834 835 <br><dt><code>-fipa-pure-const</code><dd><a name="index-fipa_002dpure_002dconst-831"></a>Discover which functions are pure or constant. 836Enabled by default at <samp><span class="option">-O</span></samp> and higher. 837 838 <br><dt><code>-fipa-reference</code><dd><a name="index-fipa_002dreference-832"></a>Discover which static variables do not escape the 839compilation unit. 840Enabled by default at <samp><span class="option">-O</span></samp> and higher. 841 842 <br><dt><code>-fipa-pta</code><dd><a name="index-fipa_002dpta-833"></a>Perform interprocedural pointer analysis and interprocedural modification 843and reference analysis. This option can cause excessive memory and 844compile-time usage on large compilation units. It is not enabled by 845default at any optimization level. 846 847 <br><dt><code>-fipa-profile</code><dd><a name="index-fipa_002dprofile-834"></a>Perform interprocedural profile propagation. The functions called only from 848cold functions are marked as cold. Also functions executed once (such as 849<code>cold</code>, <code>noreturn</code>, static constructors or destructors) are identified. Cold 850functions and loop less parts of functions executed once are then optimized for 851size. 852Enabled by default at <samp><span class="option">-O</span></samp> and higher. 853 854 <br><dt><code>-fipa-cp</code><dd><a name="index-fipa_002dcp-835"></a>Perform interprocedural constant propagation. 855This optimization analyzes the program to determine when values passed 856to functions are constants and then optimizes accordingly. 857This optimization can substantially increase performance 858if the application has constants passed to functions. 859This flag is enabled by default at <samp><span class="option">-O2</span></samp>, <samp><span class="option">-Os</span></samp> and <samp><span class="option">-O3</span></samp>. 860 861 <br><dt><code>-fipa-cp-clone</code><dd><a name="index-fipa_002dcp_002dclone-836"></a>Perform function cloning to make interprocedural constant propagation stronger. 862When enabled, interprocedural constant propagation performs function cloning 863when externally visible function can be called with constant arguments. 864Because this optimization can create multiple copies of functions, 865it may significantly increase code size 866(see <samp><span class="option">--param ipcp-unit-growth=</span><var>value</var></samp>). 867This flag is enabled by default at <samp><span class="option">-O3</span></samp>. 868 869 <br><dt><code>-ftree-sink</code><dd><a name="index-ftree_002dsink-837"></a>Perform forward store motion on trees. This flag is 870enabled by default at <samp><span class="option">-O</span></samp> and higher. 871 872 <br><dt><code>-ftree-bit-ccp</code><dd><a name="index-ftree_002dbit_002dccp-838"></a>Perform sparse conditional bit constant propagation on trees and propagate 873pointer alignment information. 874This pass only operates on local scalar variables and is enabled by default 875at <samp><span class="option">-O</span></samp> and higher. It requires that <samp><span class="option">-ftree-ccp</span></samp> is enabled. 876 877 <br><dt><code>-ftree-ccp</code><dd><a name="index-ftree_002dccp-839"></a>Perform sparse conditional constant propagation (CCP) on trees. This 878pass only operates on local scalar variables and is enabled by default 879at <samp><span class="option">-O</span></samp> and higher. 880 881 <br><dt><code>-ftree-switch-conversion</code><dd>Perform conversion of simple initializations in a switch to 882initializations from a scalar array. This flag is enabled by default 883at <samp><span class="option">-O2</span></samp> and higher. 884 885 <br><dt><code>-ftree-tail-merge</code><dd>Look for identical code sequences. When found, replace one with a jump to the 886other. This optimization is known as tail merging or cross jumping. This flag 887is enabled by default at <samp><span class="option">-O2</span></samp> and higher. The compilation time 888in this pass can 889be limited using <samp><span class="option">max-tail-merge-comparisons</span></samp> parameter and 890<samp><span class="option">max-tail-merge-iterations</span></samp> parameter. 891 892 <br><dt><code>-ftree-dce</code><dd><a name="index-ftree_002ddce-840"></a>Perform dead code elimination (DCE) on trees. This flag is enabled by 893default at <samp><span class="option">-O</span></samp> and higher. 894 895 <br><dt><code>-ftree-builtin-call-dce</code><dd><a name="index-ftree_002dbuiltin_002dcall_002ddce-841"></a>Perform conditional dead code elimination (DCE) for calls to built-in functions 896that may set <code>errno</code> but are otherwise side-effect free. This flag is 897enabled by default at <samp><span class="option">-O2</span></samp> and higher if <samp><span class="option">-Os</span></samp> is not also 898specified. 899 900 <br><dt><code>-ftree-dominator-opts</code><dd><a name="index-ftree_002ddominator_002dopts-842"></a>Perform a variety of simple scalar cleanups (constant/copy 901propagation, redundancy elimination, range propagation and expression 902simplification) based on a dominator tree traversal. This also 903performs jump threading (to reduce jumps to jumps). This flag is 904enabled by default at <samp><span class="option">-O</span></samp> and higher. 905 906 <br><dt><code>-ftree-dse</code><dd><a name="index-ftree_002ddse-843"></a>Perform dead store elimination (DSE) on trees. A dead store is a store into 907a memory location that is later overwritten by another store without 908any intervening loads. In this case the earlier store can be deleted. This 909flag is enabled by default at <samp><span class="option">-O</span></samp> and higher. 910 911 <br><dt><code>-ftree-ch</code><dd><a name="index-ftree_002dch-844"></a>Perform loop header copying on trees. This is beneficial since it increases 912effectiveness of code motion optimizations. It also saves one jump. This flag 913is enabled by default at <samp><span class="option">-O</span></samp> and higher. It is not enabled 914for <samp><span class="option">-Os</span></samp>, since it usually increases code size. 915 916 <br><dt><code>-ftree-loop-optimize</code><dd><a name="index-ftree_002dloop_002doptimize-845"></a>Perform loop optimizations on trees. This flag is enabled by default 917at <samp><span class="option">-O</span></samp> and higher. 918 919 <br><dt><code>-ftree-loop-linear</code><dd><a name="index-ftree_002dloop_002dlinear-846"></a>Perform loop interchange transformations on tree. Same as 920<samp><span class="option">-floop-interchange</span></samp>. To use this code transformation, GCC has 921to be configured with <samp><span class="option">--with-ppl</span></samp> and <samp><span class="option">--with-cloog</span></samp> to 922enable the Graphite loop transformation infrastructure. 923 924 <br><dt><code>-floop-interchange</code><dd><a name="index-floop_002dinterchange-847"></a>Perform loop interchange transformations on loops. Interchanging two 925nested loops switches the inner and outer loops. For example, given a 926loop like: 927 <pre class="smallexample"> DO J = 1, M 928 DO I = 1, N 929 A(J, I) = A(J, I) * C 930 ENDDO 931 ENDDO 932</pre> 933 <p>loop interchange transforms the loop as if it were written: 934 <pre class="smallexample"> DO I = 1, N 935 DO J = 1, M 936 A(J, I) = A(J, I) * C 937 ENDDO 938 ENDDO 939</pre> 940 <p>which can be beneficial when <code>N</code> is larger than the caches, 941because in Fortran, the elements of an array are stored in memory 942contiguously by column, and the original loop iterates over rows, 943potentially creating at each access a cache miss. This optimization 944applies to all the languages supported by GCC and is not limited to 945Fortran. To use this code transformation, GCC has to be configured 946with <samp><span class="option">--with-ppl</span></samp> and <samp><span class="option">--with-cloog</span></samp> to enable the 947Graphite loop transformation infrastructure. 948 949 <br><dt><code>-floop-strip-mine</code><dd><a name="index-floop_002dstrip_002dmine-848"></a>Perform loop strip mining transformations on loops. Strip mining 950splits a loop into two nested loops. The outer loop has strides 951equal to the strip size and the inner loop has strides of the 952original loop within a strip. The strip length can be changed 953using the <samp><span class="option">loop-block-tile-size</span></samp> parameter. For example, 954given a loop like: 955 <pre class="smallexample"> DO I = 1, N 956 A(I) = A(I) + C 957 ENDDO 958</pre> 959 <p>loop strip mining transforms the loop as if it were written: 960 <pre class="smallexample"> DO II = 1, N, 51 961 DO I = II, min (II + 50, N) 962 A(I) = A(I) + C 963 ENDDO 964 ENDDO 965</pre> 966 <p>This optimization applies to all the languages supported by GCC and is 967not limited to Fortran. To use this code transformation, GCC has to 968be configured with <samp><span class="option">--with-ppl</span></samp> and <samp><span class="option">--with-cloog</span></samp> to 969enable the Graphite loop transformation infrastructure. 970 971 <br><dt><code>-floop-block</code><dd><a name="index-floop_002dblock-849"></a>Perform loop blocking transformations on loops. Blocking strip mines 972each loop in the loop nest such that the memory accesses of the 973element loops fit inside caches. The strip length can be changed 974using the <samp><span class="option">loop-block-tile-size</span></samp> parameter. For example, given 975a loop like: 976 <pre class="smallexample"> DO I = 1, N 977 DO J = 1, M 978 A(J, I) = B(I) + C(J) 979 ENDDO 980 ENDDO 981</pre> 982 <p>loop blocking transforms the loop as if it were written: 983 <pre class="smallexample"> DO II = 1, N, 51 984 DO JJ = 1, M, 51 985 DO I = II, min (II + 50, N) 986 DO J = JJ, min (JJ + 50, M) 987 A(J, I) = B(I) + C(J) 988 ENDDO 989 ENDDO 990 ENDDO 991 ENDDO 992</pre> 993 <p>which can be beneficial when <code>M</code> is larger than the caches, 994because the innermost loop iterates over a smaller amount of data 995which can be kept in the caches. This optimization applies to all the 996languages supported by GCC and is not limited to Fortran. To use this 997code transformation, GCC has to be configured with <samp><span class="option">--with-ppl</span></samp> 998and <samp><span class="option">--with-cloog</span></samp> to enable the Graphite loop transformation 999infrastructure. 1000 1001 <br><dt><code>-fgraphite-identity</code><dd><a name="index-fgraphite_002didentity-850"></a>Enable the identity transformation for graphite. For every SCoP we generate 1002the polyhedral representation and transform it back to gimple. Using 1003<samp><span class="option">-fgraphite-identity</span></samp> we can check the costs or benefits of the 1004GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations 1005are also performed by the code generator CLooG, like index splitting and 1006dead code elimination in loops. 1007 1008 <br><dt><code>-floop-nest-optimize</code><dd><a name="index-floop_002dnest_002doptimize-851"></a>Enable the ISL based loop nest optimizer. This is a generic loop nest 1009optimizer based on the Pluto optimization algorithms. It calculates a loop 1010structure optimized for data-locality and parallelism. This option 1011is experimental. 1012 1013 <br><dt><code>-floop-parallelize-all</code><dd><a name="index-floop_002dparallelize_002dall-852"></a>Use the Graphite data dependence analysis to identify loops that can 1014be parallelized. Parallelize all the loops that can be analyzed to 1015not contain loop carried dependences without checking that it is 1016profitable to parallelize the loops. 1017 1018 <br><dt><code>-fcheck-data-deps</code><dd><a name="index-fcheck_002ddata_002ddeps-853"></a>Compare the results of several data dependence analyzers. This option 1019is used for debugging the data dependence analyzers. 1020 1021 <br><dt><code>-ftree-loop-if-convert</code><dd>Attempt to transform conditional jumps in the innermost loops to 1022branch-less equivalents. The intent is to remove control-flow from 1023the innermost loops in order to improve the ability of the 1024vectorization pass to handle these loops. This is enabled by default 1025if vectorization is enabled. 1026 1027 <br><dt><code>-ftree-loop-if-convert-stores</code><dd>Attempt to also if-convert conditional jumps containing memory writes. 1028This transformation can be unsafe for multi-threaded programs as it 1029transforms conditional memory writes into unconditional memory writes. 1030For example, 1031 <pre class="smallexample"> for (i = 0; i < N; i++) 1032 if (cond) 1033 A[i] = expr; 1034</pre> 1035 <p>is transformed to 1036 <pre class="smallexample"> for (i = 0; i < N; i++) 1037 A[i] = cond ? expr : A[i]; 1038</pre> 1039 <p>potentially producing data races. 1040 1041 <br><dt><code>-ftree-loop-distribution</code><dd>Perform loop distribution. This flag can improve cache performance on 1042big loop bodies and allow further loop optimizations, like 1043parallelization or vectorization, to take place. For example, the loop 1044 <pre class="smallexample"> DO I = 1, N 1045 A(I) = B(I) + C 1046 D(I) = E(I) * F 1047 ENDDO 1048</pre> 1049 <p>is transformed to 1050 <pre class="smallexample"> DO I = 1, N 1051 A(I) = B(I) + C 1052 ENDDO 1053 DO I = 1, N 1054 D(I) = E(I) * F 1055 ENDDO 1056</pre> 1057 <br><dt><code>-ftree-loop-distribute-patterns</code><dd>Perform loop distribution of patterns that can be code generated with 1058calls to a library. This flag is enabled by default at <samp><span class="option">-O3</span></samp>. 1059 1060 <p>This pass distributes the initialization loops and generates a call to 1061memset zero. For example, the loop 1062 <pre class="smallexample"> DO I = 1, N 1063 A(I) = 0 1064 B(I) = A(I) + I 1065 ENDDO 1066</pre> 1067 <p>is transformed to 1068 <pre class="smallexample"> DO I = 1, N 1069 A(I) = 0 1070 ENDDO 1071 DO I = 1, N 1072 B(I) = A(I) + I 1073 ENDDO 1074</pre> 1075 <p>and the initialization loop is transformed into a call to memset zero. 1076 1077 <br><dt><code>-ftree-loop-im</code><dd><a name="index-ftree_002dloop_002dim-854"></a>Perform loop invariant motion on trees. This pass moves only invariants that 1078are hard to handle at RTL level (function calls, operations that expand to 1079nontrivial sequences of insns). With <samp><span class="option">-funswitch-loops</span></samp> it also moves 1080operands of conditions that are invariant out of the loop, so that we can use 1081just trivial invariantness analysis in loop unswitching. The pass also includes 1082store motion. 1083 1084 <br><dt><code>-ftree-loop-ivcanon</code><dd><a name="index-ftree_002dloop_002divcanon-855"></a>Create a canonical counter for number of iterations in loops for which 1085determining number of iterations requires complicated analysis. Later 1086optimizations then may determine the number easily. Useful especially 1087in connection with unrolling. 1088 1089 <br><dt><code>-fivopts</code><dd><a name="index-fivopts-856"></a>Perform induction variable optimizations (strength reduction, induction 1090variable merging and induction variable elimination) on trees. 1091 1092 <br><dt><code>-ftree-parallelize-loops=n</code><dd><a name="index-ftree_002dparallelize_002dloops-857"></a>Parallelize loops, i.e., split their iteration space to run in n threads. 1093This is only possible for loops whose iterations are independent 1094and can be arbitrarily reordered. The optimization is only 1095profitable on multiprocessor machines, for loops that are CPU-intensive, 1096rather than constrained e.g. by memory bandwidth. This option 1097implies <samp><span class="option">-pthread</span></samp>, and thus is only supported on targets 1098that have support for <samp><span class="option">-pthread</span></samp>. 1099 1100 <br><dt><code>-ftree-pta</code><dd><a name="index-ftree_002dpta-858"></a>Perform function-local points-to analysis on trees. This flag is 1101enabled by default at <samp><span class="option">-O</span></samp> and higher. 1102 1103 <br><dt><code>-ftree-sra</code><dd><a name="index-ftree_002dsra-859"></a>Perform scalar replacement of aggregates. This pass replaces structure 1104references with scalars to prevent committing structures to memory too 1105early. This flag is enabled by default at <samp><span class="option">-O</span></samp> and higher. 1106 1107 <br><dt><code>-ftree-copyrename</code><dd><a name="index-ftree_002dcopyrename-860"></a>Perform copy renaming on trees. This pass attempts to rename compiler 1108temporaries to other variables at copy locations, usually resulting in 1109variable names which more closely resemble the original variables. This flag 1110is enabled by default at <samp><span class="option">-O</span></samp> and higher. 1111 1112 <br><dt><code>-ftree-coalesce-inlined-vars</code><dd>Tell the copyrename pass (see <samp><span class="option">-ftree-copyrename</span></samp>) to attempt to 1113combine small user-defined variables too, but only if they were inlined 1114from other functions. It is a more limited form of 1115<samp><span class="option">-ftree-coalesce-vars</span></samp>. This may harm debug information of such 1116inlined variables, but it will keep variables of the inlined-into 1117function apart from each other, such that they are more likely to 1118contain the expected values in a debugging session. This was the 1119default in GCC versions older than 4.7. 1120 1121 <br><dt><code>-ftree-coalesce-vars</code><dd>Tell the copyrename pass (see <samp><span class="option">-ftree-copyrename</span></samp>) to attempt to 1122combine small user-defined variables too, instead of just compiler 1123temporaries. This may severely limit the ability to debug an optimized 1124program compiled with <samp><span class="option">-fno-var-tracking-assignments</span></samp>. In the 1125negated form, this flag prevents SSA coalescing of user variables, 1126including inlined ones. This option is enabled by default. 1127 1128 <br><dt><code>-ftree-ter</code><dd><a name="index-ftree_002dter-861"></a>Perform temporary expression replacement during the SSA->normal phase. Single 1129use/single def temporaries are replaced at their use location with their 1130defining expression. This results in non-GIMPLE code, but gives the expanders 1131much more complex trees to work on resulting in better RTL generation. This is 1132enabled by default at <samp><span class="option">-O</span></samp> and higher. 1133 1134 <br><dt><code>-ftree-slsr</code><dd><a name="index-ftree_002dslsr-862"></a>Perform straight-line strength reduction on trees. This recognizes related 1135expressions involving multiplications and replaces them by less expensive 1136calculations when possible. This is enabled by default at <samp><span class="option">-O</span></samp> and 1137higher. 1138 1139 <br><dt><code>-ftree-vectorize</code><dd><a name="index-ftree_002dvectorize-863"></a>Perform loop vectorization on trees. This flag is enabled by default at 1140<samp><span class="option">-O3</span></samp>. 1141 1142 <br><dt><code>-ftree-slp-vectorize</code><dd><a name="index-ftree_002dslp_002dvectorize-864"></a>Perform basic block vectorization on trees. This flag is enabled by default at 1143<samp><span class="option">-O3</span></samp> and when <samp><span class="option">-ftree-vectorize</span></samp> is enabled. 1144 1145 <br><dt><code>-ftree-vect-loop-version</code><dd><a name="index-ftree_002dvect_002dloop_002dversion-865"></a>Perform loop versioning when doing loop vectorization on trees. When a loop 1146appears to be vectorizable except that data alignment or data dependence cannot 1147be determined at compile time, then vectorized and non-vectorized versions of 1148the loop are generated along with run-time checks for alignment or dependence 1149to control which version is executed. This option is enabled by default 1150except at level <samp><span class="option">-Os</span></samp> where it is disabled. 1151 1152 <br><dt><code>-fvect-cost-model</code><dd><a name="index-fvect_002dcost_002dmodel-866"></a>Enable cost model for vectorization. This option is enabled by default at 1153<samp><span class="option">-O3</span></samp>. 1154 1155 <br><dt><code>-ftree-vrp</code><dd><a name="index-ftree_002dvrp-867"></a>Perform Value Range Propagation on trees. This is similar to the 1156constant propagation pass, but instead of values, ranges of values are 1157propagated. This allows the optimizers to remove unnecessary range 1158checks like array bound checks and null pointer checks. This is 1159enabled by default at <samp><span class="option">-O2</span></samp> and higher. Null pointer check 1160elimination is only done if <samp><span class="option">-fdelete-null-pointer-checks</span></samp> is 1161enabled. 1162 1163 <br><dt><code>-ftracer</code><dd><a name="index-ftracer-868"></a>Perform tail duplication to enlarge superblock size. This transformation 1164simplifies the control flow of the function allowing other optimizations to do 1165a better job. 1166 1167 <br><dt><code>-funroll-loops</code><dd><a name="index-funroll_002dloops-869"></a>Unroll loops whose number of iterations can be determined at compile 1168time or upon entry to the loop. <samp><span class="option">-funroll-loops</span></samp> implies 1169<samp><span class="option">-frerun-cse-after-loop</span></samp>. This option makes code larger, 1170and may or may not make it run faster. 1171 1172 <br><dt><code>-funroll-all-loops</code><dd><a name="index-funroll_002dall_002dloops-870"></a>Unroll all loops, even if their number of iterations is uncertain when 1173the loop is entered. This usually makes programs run more slowly. 1174<samp><span class="option">-funroll-all-loops</span></samp> implies the same options as 1175<samp><span class="option">-funroll-loops</span></samp>, 1176 1177 <br><dt><code>-fsplit-ivs-in-unroller</code><dd><a name="index-fsplit_002divs_002din_002dunroller-871"></a>Enables expression of values of induction variables in later iterations 1178of the unrolled loop using the value in the first iteration. This breaks 1179long dependency chains, thus improving efficiency of the scheduling passes. 1180 1181 <p>A combination of <samp><span class="option">-fweb</span></samp> and CSE is often sufficient to obtain the 1182same effect. However, that is not reliable in cases where the loop body 1183is more complicated than a single basic block. It also does not work at all 1184on some architectures due to restrictions in the CSE pass. 1185 1186 <p>This optimization is enabled by default. 1187 1188 <br><dt><code>-fvariable-expansion-in-unroller</code><dd><a name="index-fvariable_002dexpansion_002din_002dunroller-872"></a>With this option, the compiler creates multiple copies of some 1189local variables when unrolling a loop, which can result in superior code. 1190 1191 <br><dt><code>-fpartial-inlining</code><dd><a name="index-fpartial_002dinlining-873"></a>Inline parts of functions. This option has any effect only 1192when inlining itself is turned on by the <samp><span class="option">-finline-functions</span></samp> 1193or <samp><span class="option">-finline-small-functions</span></samp> options. 1194 1195 <p>Enabled at level <samp><span class="option">-O2</span></samp>. 1196 1197 <br><dt><code>-fpredictive-commoning</code><dd><a name="index-fpredictive_002dcommoning-874"></a>Perform predictive commoning optimization, i.e., reusing computations 1198(especially memory loads and stores) performed in previous 1199iterations of loops. 1200 1201 <p>This option is enabled at level <samp><span class="option">-O3</span></samp>. 1202 1203 <br><dt><code>-fprefetch-loop-arrays</code><dd><a name="index-fprefetch_002dloop_002darrays-875"></a>If supported by the target machine, generate instructions to prefetch 1204memory to improve the performance of loops that access large arrays. 1205 1206 <p>This option may generate better or worse code; results are highly 1207dependent on the structure of loops within the source code. 1208 1209 <p>Disabled at level <samp><span class="option">-Os</span></samp>. 1210 1211 <br><dt><code>-fno-peephole</code><dt><code>-fno-peephole2</code><dd><a name="index-fno_002dpeephole-876"></a><a name="index-fno_002dpeephole2-877"></a>Disable any machine-specific peephole optimizations. The difference 1212between <samp><span class="option">-fno-peephole</span></samp> and <samp><span class="option">-fno-peephole2</span></samp> is in how they 1213are implemented in the compiler; some targets use one, some use the 1214other, a few use both. 1215 1216 <p><samp><span class="option">-fpeephole</span></samp> is enabled by default. 1217<samp><span class="option">-fpeephole2</span></samp> enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 1218 1219 <br><dt><code>-fno-guess-branch-probability</code><dd><a name="index-fno_002dguess_002dbranch_002dprobability-878"></a>Do not guess branch probabilities using heuristics. 1220 1221 <p>GCC uses heuristics to guess branch probabilities if they are 1222not provided by profiling feedback (<samp><span class="option">-fprofile-arcs</span></samp>). These 1223heuristics are based on the control flow graph. If some branch probabilities 1224are specified by ‘<samp><span class="samp">__builtin_expect</span></samp>’, then the heuristics are 1225used to guess branch probabilities for the rest of the control flow graph, 1226taking the ‘<samp><span class="samp">__builtin_expect</span></samp>’ info into account. The interactions 1227between the heuristics and ‘<samp><span class="samp">__builtin_expect</span></samp>’ can be complex, and in 1228some cases, it may be useful to disable the heuristics so that the effects 1229of ‘<samp><span class="samp">__builtin_expect</span></samp>’ are easier to understand. 1230 1231 <p>The default is <samp><span class="option">-fguess-branch-probability</span></samp> at levels 1232<samp><span class="option">-O</span></samp>, <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 1233 1234 <br><dt><code>-freorder-blocks</code><dd><a name="index-freorder_002dblocks-879"></a>Reorder basic blocks in the compiled function in order to reduce number of 1235taken branches and improve code locality. 1236 1237 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>. 1238 1239 <br><dt><code>-freorder-blocks-and-partition</code><dd><a name="index-freorder_002dblocks_002dand_002dpartition-880"></a>In addition to reordering basic blocks in the compiled function, in order 1240to reduce number of taken branches, partitions hot and cold basic blocks 1241into separate sections of the assembly and .o files, to improve 1242paging and cache locality performance. 1243 1244 <p>This optimization is automatically turned off in the presence of 1245exception handling, for linkonce sections, for functions with a user-defined 1246section attribute and on any architecture that does not support named 1247sections. 1248 1249 <br><dt><code>-freorder-functions</code><dd><a name="index-freorder_002dfunctions-881"></a>Reorder functions in the object file in order to 1250improve code locality. This is implemented by using special 1251subsections <code>.text.hot</code> for most frequently executed functions and 1252<code>.text.unlikely</code> for unlikely executed functions. Reordering is done by 1253the linker so object file format must support named sections and linker must 1254place them in a reasonable way. 1255 1256 <p>Also profile feedback must be available to make this option effective. See 1257<samp><span class="option">-fprofile-arcs</span></samp> for details. 1258 1259 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 1260 1261 <br><dt><code>-fstrict-aliasing</code><dd><a name="index-fstrict_002daliasing-882"></a>Allow the compiler to assume the strictest aliasing rules applicable to 1262the language being compiled. For C (and C++), this activates 1263optimizations based on the type of expressions. In particular, an 1264object of one type is assumed never to reside at the same address as an 1265object of a different type, unless the types are almost the same. For 1266example, an <code>unsigned int</code> can alias an <code>int</code>, but not a 1267<code>void*</code> or a <code>double</code>. A character type may alias any other 1268type. 1269 1270 <p><a name="Type_002dpunning"></a>Pay special attention to code like this: 1271 <pre class="smallexample"> union a_union { 1272 int i; 1273 double d; 1274 }; 1275 1276 int f() { 1277 union a_union t; 1278 t.d = 3.0; 1279 return t.i; 1280 } 1281</pre> 1282 <p>The practice of reading from a different union member than the one most 1283recently written to (called “type-punning”) is common. Even with 1284<samp><span class="option">-fstrict-aliasing</span></samp>, type-punning is allowed, provided the memory 1285is accessed through the union type. So, the code above works as 1286expected. See <a href="Structures-unions-enumerations-and-bit_002dfields-implementation.html#Structures-unions-enumerations-and-bit_002dfields-implementation">Structures unions enumerations and bit-fields implementation</a>. However, this code might not: 1287 <pre class="smallexample"> int f() { 1288 union a_union t; 1289 int* ip; 1290 t.d = 3.0; 1291 ip = &t.i; 1292 return *ip; 1293 } 1294</pre> 1295 <p>Similarly, access by taking the address, casting the resulting pointer 1296and dereferencing the result has undefined behavior, even if the cast 1297uses a union type, e.g.: 1298 <pre class="smallexample"> int f() { 1299 double d = 3.0; 1300 return ((union a_union *) &d)->i; 1301 } 1302</pre> 1303 <p>The <samp><span class="option">-fstrict-aliasing</span></samp> option is enabled at levels 1304<samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 1305 1306 <br><dt><code>-fstrict-overflow</code><dd><a name="index-fstrict_002doverflow-883"></a>Allow the compiler to assume strict signed overflow rules, depending 1307on the language being compiled. For C (and C++) this means that 1308overflow when doing arithmetic with signed numbers is undefined, which 1309means that the compiler may assume that it does not happen. This 1310permits various optimizations. For example, the compiler assumes 1311that an expression like <code>i + 10 > i</code> is always true for 1312signed <code>i</code>. This assumption is only valid if signed overflow is 1313undefined, as the expression is false if <code>i + 10</code> overflows when 1314using twos complement arithmetic. When this option is in effect any 1315attempt to determine whether an operation on signed numbers 1316overflows must be written carefully to not actually involve overflow. 1317 1318 <p>This option also allows the compiler to assume strict pointer 1319semantics: given a pointer to an object, if adding an offset to that 1320pointer does not produce a pointer to the same object, the addition is 1321undefined. This permits the compiler to conclude that <code>p + u > 1322p</code> is always true for a pointer <code>p</code> and unsigned integer 1323<code>u</code>. This assumption is only valid because pointer wraparound is 1324undefined, as the expression is false if <code>p + u</code> overflows using 1325twos complement arithmetic. 1326 1327 <p>See also the <samp><span class="option">-fwrapv</span></samp> option. Using <samp><span class="option">-fwrapv</span></samp> means 1328that integer signed overflow is fully defined: it wraps. When 1329<samp><span class="option">-fwrapv</span></samp> is used, there is no difference between 1330<samp><span class="option">-fstrict-overflow</span></samp> and <samp><span class="option">-fno-strict-overflow</span></samp> for 1331integers. With <samp><span class="option">-fwrapv</span></samp> certain types of overflow are 1332permitted. For example, if the compiler gets an overflow when doing 1333arithmetic on constants, the overflowed value can still be used with 1334<samp><span class="option">-fwrapv</span></samp>, but not otherwise. 1335 1336 <p>The <samp><span class="option">-fstrict-overflow</span></samp> option is enabled at levels 1337<samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 1338 1339 <br><dt><code>-falign-functions</code><dt><code>-falign-functions=</code><var>n</var><dd><a name="index-falign_002dfunctions-884"></a>Align the start of functions to the next power-of-two greater than 1340<var>n</var>, skipping up to <var>n</var> bytes. For instance, 1341<samp><span class="option">-falign-functions=32</span></samp> aligns functions to the next 32-byte 1342boundary, but <samp><span class="option">-falign-functions=24</span></samp> aligns to the next 134332-byte boundary only if this can be done by skipping 23 bytes or less. 1344 1345 <p><samp><span class="option">-fno-align-functions</span></samp> and <samp><span class="option">-falign-functions=1</span></samp> are 1346equivalent and mean that functions are not aligned. 1347 1348 <p>Some assemblers only support this flag when <var>n</var> is a power of two; 1349in that case, it is rounded up. 1350 1351 <p>If <var>n</var> is not specified or is zero, use a machine-dependent default. 1352 1353 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>. 1354 1355 <br><dt><code>-falign-labels</code><dt><code>-falign-labels=</code><var>n</var><dd><a name="index-falign_002dlabels-885"></a>Align all branch targets to a power-of-two boundary, skipping up to 1356<var>n</var> bytes like <samp><span class="option">-falign-functions</span></samp>. This option can easily 1357make code slower, because it must insert dummy operations for when the 1358branch target is reached in the usual flow of the code. 1359 1360 <p><samp><span class="option">-fno-align-labels</span></samp> and <samp><span class="option">-falign-labels=1</span></samp> are 1361equivalent and mean that labels are not aligned. 1362 1363 <p>If <samp><span class="option">-falign-loops</span></samp> or <samp><span class="option">-falign-jumps</span></samp> are applicable and 1364are greater than this value, then their values are used instead. 1365 1366 <p>If <var>n</var> is not specified or is zero, use a machine-dependent default 1367which is very likely to be ‘<samp><span class="samp">1</span></samp>’, meaning no alignment. 1368 1369 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>. 1370 1371 <br><dt><code>-falign-loops</code><dt><code>-falign-loops=</code><var>n</var><dd><a name="index-falign_002dloops-886"></a>Align loops to a power-of-two boundary, skipping up to <var>n</var> bytes 1372like <samp><span class="option">-falign-functions</span></samp>. If the loops are 1373executed many times, this makes up for any execution of the dummy 1374operations. 1375 1376 <p><samp><span class="option">-fno-align-loops</span></samp> and <samp><span class="option">-falign-loops=1</span></samp> are 1377equivalent and mean that loops are not aligned. 1378 1379 <p>If <var>n</var> is not specified or is zero, use a machine-dependent default. 1380 1381 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>. 1382 1383 <br><dt><code>-falign-jumps</code><dt><code>-falign-jumps=</code><var>n</var><dd><a name="index-falign_002djumps-887"></a>Align branch targets to a power-of-two boundary, for branch targets 1384where the targets can only be reached by jumping, skipping up to <var>n</var> 1385bytes like <samp><span class="option">-falign-functions</span></samp>. In this case, no dummy operations 1386need be executed. 1387 1388 <p><samp><span class="option">-fno-align-jumps</span></samp> and <samp><span class="option">-falign-jumps=1</span></samp> are 1389equivalent and mean that loops are not aligned. 1390 1391 <p>If <var>n</var> is not specified or is zero, use a machine-dependent default. 1392 1393 <p>Enabled at levels <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>. 1394 1395 <br><dt><code>-funit-at-a-time</code><dd><a name="index-funit_002dat_002da_002dtime-888"></a>This option is left for compatibility reasons. <samp><span class="option">-funit-at-a-time</span></samp> 1396has no effect, while <samp><span class="option">-fno-unit-at-a-time</span></samp> implies 1397<samp><span class="option">-fno-toplevel-reorder</span></samp> and <samp><span class="option">-fno-section-anchors</span></samp>. 1398 1399 <p>Enabled by default. 1400 1401 <br><dt><code>-fno-toplevel-reorder</code><dd><a name="index-fno_002dtoplevel_002dreorder-889"></a>Do not reorder top-level functions, variables, and <code>asm</code> 1402statements. Output them in the same order that they appear in the 1403input file. When this option is used, unreferenced static variables 1404are not removed. This option is intended to support existing code 1405that relies on a particular ordering. For new code, it is better to 1406use attributes. 1407 1408 <p>Enabled at level <samp><span class="option">-O0</span></samp>. When disabled explicitly, it also implies 1409<samp><span class="option">-fno-section-anchors</span></samp>, which is otherwise enabled at <samp><span class="option">-O0</span></samp> on some 1410targets. 1411 1412 <br><dt><code>-fweb</code><dd><a name="index-fweb-890"></a>Constructs webs as commonly used for register allocation purposes and assign 1413each web individual pseudo register. This allows the register allocation pass 1414to operate on pseudos directly, but also strengthens several other optimization 1415passes, such as CSE, loop optimizer and trivial dead code remover. It can, 1416however, make debugging impossible, since variables no longer stay in a 1417“home register”. 1418 1419 <p>Enabled by default with <samp><span class="option">-funroll-loops</span></samp>. 1420 1421 <br><dt><code>-fwhole-program</code><dd><a name="index-fwhole_002dprogram-891"></a>Assume that the current compilation unit represents the whole program being 1422compiled. All public functions and variables with the exception of <code>main</code> 1423and those merged by attribute <code>externally_visible</code> become static functions 1424and in effect are optimized more aggressively by interprocedural optimizers. 1425 1426 <p>This option should not be used in combination with <code>-flto</code>. 1427Instead relying on a linker plugin should provide safer and more precise 1428information. 1429 1430 <br><dt><code>-flto[=</code><var>n</var><code>]</code><dd><a name="index-flto-892"></a>This option runs the standard link-time optimizer. When invoked 1431with source code, it generates GIMPLE (one of GCC's internal 1432representations) and writes it to special ELF sections in the object 1433file. When the object files are linked together, all the function 1434bodies are read from these ELF sections and instantiated as if they 1435had been part of the same translation unit. 1436 1437 <p>To use the link-time optimizer, <samp><span class="option">-flto</span></samp> needs to be specified at 1438compile time and during the final link. For example: 1439 1440 <pre class="smallexample"> gcc -c -O2 -flto foo.c 1441 gcc -c -O2 -flto bar.c 1442 gcc -o myprog -flto -O2 foo.o bar.o 1443</pre> 1444 <p>The first two invocations to GCC save a bytecode representation 1445of GIMPLE into special ELF sections inside <samp><span class="file">foo.o</span></samp> and 1446<samp><span class="file">bar.o</span></samp>. The final invocation reads the GIMPLE bytecode from 1447<samp><span class="file">foo.o</span></samp> and <samp><span class="file">bar.o</span></samp>, merges the two files into a single 1448internal image, and compiles the result as usual. Since both 1449<samp><span class="file">foo.o</span></samp> and <samp><span class="file">bar.o</span></samp> are merged into a single image, this 1450causes all the interprocedural analyses and optimizations in GCC to 1451work across the two files as if they were a single one. This means, 1452for example, that the inliner is able to inline functions in 1453<samp><span class="file">bar.o</span></samp> into functions in <samp><span class="file">foo.o</span></samp> and vice-versa. 1454 1455 <p>Another (simpler) way to enable link-time optimization is: 1456 1457 <pre class="smallexample"> gcc -o myprog -flto -O2 foo.c bar.c 1458</pre> 1459 <p>The above generates bytecode for <samp><span class="file">foo.c</span></samp> and <samp><span class="file">bar.c</span></samp>, 1460merges them together into a single GIMPLE representation and optimizes 1461them as usual to produce <samp><span class="file">myprog</span></samp>. 1462 1463 <p>The only important thing to keep in mind is that to enable link-time 1464optimizations the <samp><span class="option">-flto</span></samp> flag needs to be passed to both the 1465compile and the link commands. 1466 1467 <p>To make whole program optimization effective, it is necessary to make 1468certain whole program assumptions. The compiler needs to know 1469what functions and variables can be accessed by libraries and runtime 1470outside of the link-time optimized unit. When supported by the linker, 1471the linker plugin (see <samp><span class="option">-fuse-linker-plugin</span></samp>) passes information 1472to the compiler about used and externally visible symbols. When 1473the linker plugin is not available, <samp><span class="option">-fwhole-program</span></samp> should be 1474used to allow the compiler to make these assumptions, which leads 1475to more aggressive optimization decisions. 1476 1477 <p>Note that when a file is compiled with <samp><span class="option">-flto</span></samp>, the generated 1478object file is larger than a regular object file because it 1479contains GIMPLE bytecodes and the usual final code. This means that 1480object files with LTO information can be linked as normal object 1481files; if <samp><span class="option">-flto</span></samp> is not passed to the linker, no 1482interprocedural optimizations are applied. 1483 1484 <p>Additionally, the optimization flags used to compile individual files 1485are not necessarily related to those used at link time. For instance, 1486 1487 <pre class="smallexample"> gcc -c -O0 -flto foo.c 1488 gcc -c -O0 -flto bar.c 1489 gcc -o myprog -flto -O3 foo.o bar.o 1490</pre> 1491 <p>This produces individual object files with unoptimized assembler 1492code, but the resulting binary <samp><span class="file">myprog</span></samp> is optimized at 1493<samp><span class="option">-O3</span></samp>. If, instead, the final binary is generated without 1494<samp><span class="option">-flto</span></samp>, then <samp><span class="file">myprog</span></samp> is not optimized. 1495 1496 <p>When producing the final binary with <samp><span class="option">-flto</span></samp>, GCC only 1497applies link-time optimizations to those files that contain bytecode. 1498Therefore, you can mix and match object files and libraries with 1499GIMPLE bytecodes and final object code. GCC automatically selects 1500which files to optimize in LTO mode and which files to link without 1501further processing. 1502 1503 <p>There are some code generation flags preserved by GCC when 1504generating bytecodes, as they need to be used during the final link 1505stage. Currently, the following options are saved into the GIMPLE 1506bytecode files: <samp><span class="option">-fPIC</span></samp>, <samp><span class="option">-fcommon</span></samp> and all the 1507<samp><span class="option">-m</span></samp> target flags. 1508 1509 <p>At link time, these options are read in and reapplied. Note that the 1510current implementation makes no attempt to recognize conflicting 1511values for these options. If different files have conflicting option 1512values (e.g., one file is compiled with <samp><span class="option">-fPIC</span></samp> and another 1513isn't), the compiler simply uses the last value read from the 1514bytecode files. It is recommended, then, that you compile all the files 1515participating in the same link with the same options. 1516 1517 <p>If LTO encounters objects with C linkage declared with incompatible 1518types in separate translation units to be linked together (undefined 1519behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be 1520issued. The behavior is still undefined at run time. 1521 1522 <p>Another feature of LTO is that it is possible to apply interprocedural 1523optimizations on files written in different languages. This requires 1524support in the language front end. Currently, the C, C++ and 1525Fortran front ends are capable of emitting GIMPLE bytecodes, so 1526something like this should work: 1527 1528 <pre class="smallexample"> gcc -c -flto foo.c 1529 g++ -c -flto bar.cc 1530 gfortran -c -flto baz.f90 1531 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran 1532</pre> 1533 <p>Notice that the final link is done with <samp><span class="command">g++</span></samp> to get the C++ 1534runtime libraries and <samp><span class="option">-lgfortran</span></samp> is added to get the Fortran 1535runtime libraries. In general, when mixing languages in LTO mode, you 1536should use the same link command options as when mixing languages in a 1537regular (non-LTO) compilation; all you need to add is <samp><span class="option">-flto</span></samp> to 1538all the compile and link commands. 1539 1540 <p>If object files containing GIMPLE bytecode are stored in a library archive, say 1541<samp><span class="file">libfoo.a</span></samp>, it is possible to extract and use them in an LTO link if you 1542are using a linker with plugin support. To enable this feature, use 1543the flag <samp><span class="option">-fuse-linker-plugin</span></samp> at link time: 1544 1545 <pre class="smallexample"> gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo 1546</pre> 1547 <p>With the linker plugin enabled, the linker extracts the needed 1548GIMPLE files from <samp><span class="file">libfoo.a</span></samp> and passes them on to the running GCC 1549to make them part of the aggregated GIMPLE image to be optimized. 1550 1551 <p>If you are not using a linker with plugin support and/or do not 1552enable the linker plugin, then the objects inside <samp><span class="file">libfoo.a</span></samp> 1553are extracted and linked as usual, but they do not participate 1554in the LTO optimization process. 1555 1556 <p>Link-time optimizations do not require the presence of the whole program to 1557operate. If the program does not require any symbols to be exported, it is 1558possible to combine <samp><span class="option">-flto</span></samp> and <samp><span class="option">-fwhole-program</span></samp> to allow 1559the interprocedural optimizers to use more aggressive assumptions which may 1560lead to improved optimization opportunities. 1561Use of <samp><span class="option">-fwhole-program</span></samp> is not needed when linker plugin is 1562active (see <samp><span class="option">-fuse-linker-plugin</span></samp>). 1563 1564 <p>The current implementation of LTO makes no 1565attempt to generate bytecode that is portable between different 1566types of hosts. The bytecode files are versioned and there is a 1567strict version check, so bytecode files generated in one version of 1568GCC will not work with an older/newer version of GCC. 1569 1570 <p>Link-time optimization does not work well with generation of debugging 1571information. Combining <samp><span class="option">-flto</span></samp> with 1572<samp><span class="option">-g</span></samp> is currently experimental and expected to produce wrong 1573results. 1574 1575 <p>If you specify the optional <var>n</var>, the optimization and code 1576generation done at link time is executed in parallel using <var>n</var> 1577parallel jobs by utilizing an installed <samp><span class="command">make</span></samp> program. The 1578environment variable <samp><span class="env">MAKE</span></samp> may be used to override the program 1579used. The default value for <var>n</var> is 1. 1580 1581 <p>You can also specify <samp><span class="option">-flto=jobserver</span></samp> to use GNU make's 1582job server mode to determine the number of parallel jobs. This 1583is useful when the Makefile calling GCC is already executing in parallel. 1584You must prepend a ‘<samp><span class="samp">+</span></samp>’ to the command recipe in the parent Makefile 1585for this to work. This option likely only works if <samp><span class="env">MAKE</span></samp> is 1586GNU make. 1587 1588 <p>This option is disabled by default. 1589 1590 <br><dt><code>-flto-partition=</code><var>alg</var><dd><a name="index-flto_002dpartition-893"></a>Specify the partitioning algorithm used by the link-time optimizer. 1591The value is either <code>1to1</code> to specify a partitioning mirroring 1592the original source files or <code>balanced</code> to specify partitioning 1593into equally sized chunks (whenever possible) or <code>max</code> to create 1594new partition for every symbol where possible. Specifying <code>none</code> 1595as an algorithm disables partitioning and streaming completely. 1596The default value is <code>balanced</code>. While <code>1to1</code> can be used 1597as an workaround for various code ordering issues, the <code>max</code> 1598partitioning is intended for internal testing only. 1599 1600 <br><dt><code>-flto-compression-level=</code><var>n</var><dd>This option specifies the level of compression used for intermediate 1601language written to LTO object files, and is only meaningful in 1602conjunction with LTO mode (<samp><span class="option">-flto</span></samp>). Valid 1603values are 0 (no compression) to 9 (maximum compression). Values 1604outside this range are clamped to either 0 or 9. If the option is not 1605given, a default balanced compression setting is used. 1606 1607 <br><dt><code>-flto-report</code><dd>Prints a report with internal details on the workings of the link-time 1608optimizer. The contents of this report vary from version to version. 1609It is meant to be useful to GCC developers when processing object 1610files in LTO mode (via <samp><span class="option">-flto</span></samp>). 1611 1612 <p>Disabled by default. 1613 1614 <br><dt><code>-fuse-linker-plugin</code><dd>Enables the use of a linker plugin during link-time optimization. This 1615option relies on plugin support in the linker, which is available in gold 1616or in GNU ld 2.21 or newer. 1617 1618 <p>This option enables the extraction of object files with GIMPLE bytecode out 1619of library archives. This improves the quality of optimization by exposing 1620more code to the link-time optimizer. This information specifies what 1621symbols can be accessed externally (by non-LTO object or during dynamic 1622linking). Resulting code quality improvements on binaries (and shared 1623libraries that use hidden visibility) are similar to <code>-fwhole-program</code>. 1624See <samp><span class="option">-flto</span></samp> for a description of the effect of this flag and how to 1625use it. 1626 1627 <p>This option is enabled by default when LTO support in GCC is enabled 1628and GCC was configured for use with 1629a linker supporting plugins (GNU ld 2.21 or newer or gold). 1630 1631 <br><dt><code>-ffat-lto-objects</code><dd><a name="index-ffat_002dlto_002dobjects-894"></a>Fat LTO objects are object files that contain both the intermediate language 1632and the object code. This makes them usable for both LTO linking and normal 1633linking. This option is effective only when compiling with <samp><span class="option">-flto</span></samp> 1634and is ignored at link time. 1635 1636 <p><samp><span class="option">-fno-fat-lto-objects</span></samp> improves compilation time over plain LTO, but 1637requires the complete toolchain to be aware of LTO. It requires a linker with 1638linker plugin support for basic functionality. Additionally, 1639<samp><span class="command">nm</span></samp>, <samp><span class="command">ar</span></samp> and <samp><span class="command">ranlib</span></samp> 1640need to support linker plugins to allow a full-featured build environment 1641(capable of building static libraries etc). GCC provides the <samp><span class="command">gcc-ar</span></samp>, 1642<samp><span class="command">gcc-nm</span></samp>, <samp><span class="command">gcc-ranlib</span></samp> wrappers to pass the right options 1643to these tools. With non fat LTO makefiles need to be modified to use them. 1644 1645 <p>The default is <samp><span class="option">-ffat-lto-objects</span></samp> but this default is intended to 1646change in future releases when linker plugin enabled environments become more 1647common. 1648 1649 <br><dt><code>-fcompare-elim</code><dd><a name="index-fcompare_002delim-895"></a>After register allocation and post-register allocation instruction splitting, 1650identify arithmetic instructions that compute processor flags similar to a 1651comparison operation based on that arithmetic. If possible, eliminate the 1652explicit comparison operation. 1653 1654 <p>This pass only applies to certain targets that cannot explicitly represent 1655the comparison operation before register allocation is complete. 1656 1657 <p>Enabled at levels <samp><span class="option">-O</span></samp>, <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 1658 1659 <br><dt><code>-fuse-ld=bfd</code><dd>Use the <samp><span class="command">bfd</span></samp> linker instead of the default linker. 1660 1661 <br><dt><code>-fuse-ld=gold</code><dd>Use the <samp><span class="command">gold</span></samp> linker instead of the default linker. 1662 1663 <br><dt><code>-fcprop-registers</code><dd><a name="index-fcprop_002dregisters-896"></a>After register allocation and post-register allocation instruction splitting, 1664perform a copy-propagation pass to try to reduce scheduling dependencies 1665and occasionally eliminate the copy. 1666 1667 <p>Enabled at levels <samp><span class="option">-O</span></samp>, <samp><span class="option">-O2</span></samp>, <samp><span class="option">-O3</span></samp>, <samp><span class="option">-Os</span></samp>. 1668 1669 <br><dt><code>-fprofile-correction</code><dd><a name="index-fprofile_002dcorrection-897"></a>Profiles collected using an instrumented binary for multi-threaded programs may 1670be inconsistent due to missed counter updates. When this option is specified, 1671GCC uses heuristics to correct or smooth out such inconsistencies. By 1672default, GCC emits an error message when an inconsistent profile is detected. 1673 1674 <br><dt><code>-fprofile-dir=</code><var>path</var><dd><a name="index-fprofile_002ddir-898"></a> 1675Set the directory to search for the profile data files in to <var>path</var>. 1676This option affects only the profile data generated by 1677<samp><span class="option">-fprofile-generate</span></samp>, <samp><span class="option">-ftest-coverage</span></samp>, <samp><span class="option">-fprofile-arcs</span></samp> 1678and used by <samp><span class="option">-fprofile-use</span></samp> and <samp><span class="option">-fbranch-probabilities</span></samp> 1679and its related options. Both absolute and relative paths can be used. 1680By default, GCC uses the current directory as <var>path</var>, thus the 1681profile data file appears in the same directory as the object file. 1682 1683 <br><dt><code>-fprofile-generate</code><dt><code>-fprofile-generate=</code><var>path</var><dd><a name="index-fprofile_002dgenerate-899"></a> 1684Enable options usually used for instrumenting application to produce 1685profile useful for later recompilation with profile feedback based 1686optimization. You must use <samp><span class="option">-fprofile-generate</span></samp> both when 1687compiling and when linking your program. 1688 1689 <p>The following options are enabled: <code>-fprofile-arcs</code>, <code>-fprofile-values</code>, <code>-fvpt</code>. 1690 1691 <p>If <var>path</var> is specified, GCC looks at the <var>path</var> to find 1692the profile feedback data files. See <samp><span class="option">-fprofile-dir</span></samp>. 1693 1694 <br><dt><code>-fprofile-use</code><dt><code>-fprofile-use=</code><var>path</var><dd><a name="index-fprofile_002duse-900"></a>Enable profile feedback directed optimizations, and optimizations 1695generally profitable only with profile feedback available. 1696 1697 <p>The following options are enabled: <code>-fbranch-probabilities</code>, <code>-fvpt</code>, 1698<code>-funroll-loops</code>, <code>-fpeel-loops</code>, <code>-ftracer</code>, <code>-ftree-vectorize</code>, 1699<code>ftree-loop-distribute-patterns</code> 1700 1701 <p>By default, GCC emits an error message if the feedback profiles do not 1702match the source code. This error can be turned into a warning by using 1703<samp><span class="option">-Wcoverage-mismatch</span></samp>. Note this may result in poorly optimized 1704code. 1705 1706 <p>If <var>path</var> is specified, GCC looks at the <var>path</var> to find 1707the profile feedback data files. See <samp><span class="option">-fprofile-dir</span></samp>. 1708</dl> 1709 1710 <p>The following options control compiler behavior regarding floating-point 1711arithmetic. These options trade off between speed and 1712correctness. All must be specifically enabled. 1713 1714 <dl> 1715<dt><code>-ffloat-store</code><dd><a name="index-ffloat_002dstore-901"></a>Do not store floating-point variables in registers, and inhibit other 1716options that might change whether a floating-point value is taken from a 1717register or memory. 1718 1719 <p><a name="index-floating_002dpoint-precision-902"></a>This option prevents undesirable excess precision on machines such as 1720the 68000 where the floating registers (of the 68881) keep more 1721precision than a <code>double</code> is supposed to have. Similarly for the 1722x86 architecture. For most programs, the excess precision does only 1723good, but a few programs rely on the precise definition of IEEE floating 1724point. Use <samp><span class="option">-ffloat-store</span></samp> for such programs, after modifying 1725them to store all pertinent intermediate computations into variables. 1726 1727 <br><dt><code>-fexcess-precision=</code><var>style</var><dd><a name="index-fexcess_002dprecision-903"></a>This option allows further control over excess precision on machines 1728where floating-point registers have more precision than the IEEE 1729<code>float</code> and <code>double</code> types and the processor does not 1730support operations rounding to those types. By default, 1731<samp><span class="option">-fexcess-precision=fast</span></samp> is in effect; this means that 1732operations are carried out in the precision of the registers and that 1733it is unpredictable when rounding to the types specified in the source 1734code takes place. When compiling C, if 1735<samp><span class="option">-fexcess-precision=standard</span></samp> is specified then excess 1736precision follows the rules specified in ISO C99; in particular, 1737both casts and assignments cause values to be rounded to their 1738semantic types (whereas <samp><span class="option">-ffloat-store</span></samp> only affects 1739assignments). This option is enabled by default for C if a strict 1740conformance option such as <samp><span class="option">-std=c99</span></samp> is used. 1741 1742 <p><a name="index-mfpmath-904"></a><samp><span class="option">-fexcess-precision=standard</span></samp> is not implemented for languages 1743other than C, and has no effect if 1744<samp><span class="option">-funsafe-math-optimizations</span></samp> or <samp><span class="option">-ffast-math</span></samp> is 1745specified. On the x86, it also has no effect if <samp><span class="option">-mfpmath=sse</span></samp> 1746or <samp><span class="option">-mfpmath=sse+387</span></samp> is specified; in the former case, IEEE 1747semantics apply without excess precision, and in the latter, rounding 1748is unpredictable. 1749 1750 <br><dt><code>-ffast-math</code><dd><a name="index-ffast_002dmath-905"></a>Sets <samp><span class="option">-fno-math-errno</span></samp>, <samp><span class="option">-funsafe-math-optimizations</span></samp>, 1751<samp><span class="option">-ffinite-math-only</span></samp>, <samp><span class="option">-fno-rounding-math</span></samp>, 1752<samp><span class="option">-fno-signaling-nans</span></samp> and <samp><span class="option">-fcx-limited-range</span></samp>. 1753 1754 <p>This option causes the preprocessor macro <code>__FAST_MATH__</code> to be defined. 1755 1756 <p>This option is not turned on by any <samp><span class="option">-O</span></samp> option besides 1757<samp><span class="option">-Ofast</span></samp> since it can result in incorrect output for programs 1758that depend on an exact implementation of IEEE or ISO rules/specifications 1759for math functions. It may, however, yield faster code for programs 1760that do not require the guarantees of these specifications. 1761 1762 <br><dt><code>-fno-math-errno</code><dd><a name="index-fno_002dmath_002derrno-906"></a>Do not set <code>errno</code> after calling math functions that are executed 1763with a single instruction, e.g., <code>sqrt</code>. A program that relies on 1764IEEE exceptions for math error handling may want to use this flag 1765for speed while maintaining IEEE arithmetic compatibility. 1766 1767 <p>This option is not turned on by any <samp><span class="option">-O</span></samp> option since 1768it can result in incorrect output for programs that depend on 1769an exact implementation of IEEE or ISO rules/specifications for 1770math functions. It may, however, yield faster code for programs 1771that do not require the guarantees of these specifications. 1772 1773 <p>The default is <samp><span class="option">-fmath-errno</span></samp>. 1774 1775 <p>On Darwin systems, the math library never sets <code>errno</code>. There is 1776therefore no reason for the compiler to consider the possibility that 1777it might, and <samp><span class="option">-fno-math-errno</span></samp> is the default. 1778 1779 <br><dt><code>-funsafe-math-optimizations</code><dd><a name="index-funsafe_002dmath_002doptimizations-907"></a> 1780Allow optimizations for floating-point arithmetic that (a) assume 1781that arguments and results are valid and (b) may violate IEEE or 1782ANSI standards. When used at link-time, it may include libraries 1783or startup files that change the default FPU control word or other 1784similar optimizations. 1785 1786 <p>This option is not turned on by any <samp><span class="option">-O</span></samp> option since 1787it can result in incorrect output for programs that depend on 1788an exact implementation of IEEE or ISO rules/specifications for 1789math functions. It may, however, yield faster code for programs 1790that do not require the guarantees of these specifications. 1791Enables <samp><span class="option">-fno-signed-zeros</span></samp>, <samp><span class="option">-fno-trapping-math</span></samp>, 1792<samp><span class="option">-fassociative-math</span></samp> and <samp><span class="option">-freciprocal-math</span></samp>. 1793 1794 <p>The default is <samp><span class="option">-fno-unsafe-math-optimizations</span></samp>. 1795 1796 <br><dt><code>-fassociative-math</code><dd><a name="index-fassociative_002dmath-908"></a> 1797Allow re-association of operands in series of floating-point operations. 1798This violates the ISO C and C++ language standard by possibly changing 1799computation result. NOTE: re-ordering may change the sign of zero as 1800well as ignore NaNs and inhibit or create underflow or overflow (and 1801thus cannot be used on code that relies on rounding behavior like 1802<code>(x + 2**52) - 2**52</code>. May also reorder floating-point comparisons 1803and thus may not be used when ordered comparisons are required. 1804This option requires that both <samp><span class="option">-fno-signed-zeros</span></samp> and 1805<samp><span class="option">-fno-trapping-math</span></samp> be in effect. Moreover, it doesn't make 1806much sense with <samp><span class="option">-frounding-math</span></samp>. For Fortran the option 1807is automatically enabled when both <samp><span class="option">-fno-signed-zeros</span></samp> and 1808<samp><span class="option">-fno-trapping-math</span></samp> are in effect. 1809 1810 <p>The default is <samp><span class="option">-fno-associative-math</span></samp>. 1811 1812 <br><dt><code>-freciprocal-math</code><dd><a name="index-freciprocal_002dmath-909"></a> 1813Allow the reciprocal of a value to be used instead of dividing by 1814the value if this enables optimizations. For example <code>x / y</code> 1815can be replaced with <code>x * (1/y)</code>, which is useful if <code>(1/y)</code> 1816is subject to common subexpression elimination. Note that this loses 1817precision and increases the number of flops operating on the value. 1818 1819 <p>The default is <samp><span class="option">-fno-reciprocal-math</span></samp>. 1820 1821 <br><dt><code>-ffinite-math-only</code><dd><a name="index-ffinite_002dmath_002donly-910"></a>Allow optimizations for floating-point arithmetic that assume 1822that arguments and results are not NaNs or +-Infs. 1823 1824 <p>This option is not turned on by any <samp><span class="option">-O</span></samp> option since 1825it can result in incorrect output for programs that depend on 1826an exact implementation of IEEE or ISO rules/specifications for 1827math functions. It may, however, yield faster code for programs 1828that do not require the guarantees of these specifications. 1829 1830 <p>The default is <samp><span class="option">-fno-finite-math-only</span></samp>. 1831 1832 <br><dt><code>-fno-signed-zeros</code><dd><a name="index-fno_002dsigned_002dzeros-911"></a>Allow optimizations for floating-point arithmetic that ignore the 1833signedness of zero. IEEE arithmetic specifies the behavior of 1834distinct +0.0 and −0.0 values, which then prohibits simplification 1835of expressions such as x+0.0 or 0.0*x (even with <samp><span class="option">-ffinite-math-only</span></samp>). 1836This option implies that the sign of a zero result isn't significant. 1837 1838 <p>The default is <samp><span class="option">-fsigned-zeros</span></samp>. 1839 1840 <br><dt><code>-fno-trapping-math</code><dd><a name="index-fno_002dtrapping_002dmath-912"></a>Compile code assuming that floating-point operations cannot generate 1841user-visible traps. These traps include division by zero, overflow, 1842underflow, inexact result and invalid operation. This option requires 1843that <samp><span class="option">-fno-signaling-nans</span></samp> be in effect. Setting this option may 1844allow faster code if one relies on “non-stop” IEEE arithmetic, for example. 1845 1846 <p>This option should never be turned on by any <samp><span class="option">-O</span></samp> option since 1847it can result in incorrect output for programs that depend on 1848an exact implementation of IEEE or ISO rules/specifications for 1849math functions. 1850 1851 <p>The default is <samp><span class="option">-ftrapping-math</span></samp>. 1852 1853 <br><dt><code>-frounding-math</code><dd><a name="index-frounding_002dmath-913"></a>Disable transformations and optimizations that assume default floating-point 1854rounding behavior. This is round-to-zero for all floating point 1855to integer conversions, and round-to-nearest for all other arithmetic 1856truncations. This option should be specified for programs that change 1857the FP rounding mode dynamically, or that may be executed with a 1858non-default rounding mode. This option disables constant folding of 1859floating-point expressions at compile time (which may be affected by 1860rounding mode) and arithmetic transformations that are unsafe in the 1861presence of sign-dependent rounding modes. 1862 1863 <p>The default is <samp><span class="option">-fno-rounding-math</span></samp>. 1864 1865 <p>This option is experimental and does not currently guarantee to 1866disable all GCC optimizations that are affected by rounding mode. 1867Future versions of GCC may provide finer control of this setting 1868using C99's <code>FENV_ACCESS</code> pragma. This command-line option 1869will be used to specify the default state for <code>FENV_ACCESS</code>. 1870 1871 <br><dt><code>-fsignaling-nans</code><dd><a name="index-fsignaling_002dnans-914"></a>Compile code assuming that IEEE signaling NaNs may generate user-visible 1872traps during floating-point operations. Setting this option disables 1873optimizations that may change the number of exceptions visible with 1874signaling NaNs. This option implies <samp><span class="option">-ftrapping-math</span></samp>. 1875 1876 <p>This option causes the preprocessor macro <code>__SUPPORT_SNAN__</code> to 1877be defined. 1878 1879 <p>The default is <samp><span class="option">-fno-signaling-nans</span></samp>. 1880 1881 <p>This option is experimental and does not currently guarantee to 1882disable all GCC optimizations that affect signaling NaN behavior. 1883 1884 <br><dt><code>-fsingle-precision-constant</code><dd><a name="index-fsingle_002dprecision_002dconstant-915"></a>Treat floating-point constants as single precision instead of 1885implicitly converting them to double-precision constants. 1886 1887 <br><dt><code>-fcx-limited-range</code><dd><a name="index-fcx_002dlimited_002drange-916"></a>When enabled, this option states that a range reduction step is not 1888needed when performing complex division. Also, there is no checking 1889whether the result of a complex multiplication or division is <code>NaN 1890+ I*NaN</code>, with an attempt to rescue the situation in that case. The 1891default is <samp><span class="option">-fno-cx-limited-range</span></samp>, but is enabled by 1892<samp><span class="option">-ffast-math</span></samp>. 1893 1894 <p>This option controls the default setting of the ISO C99 1895<code>CX_LIMITED_RANGE</code> pragma. Nevertheless, the option applies to 1896all languages. 1897 1898 <br><dt><code>-fcx-fortran-rules</code><dd><a name="index-fcx_002dfortran_002drules-917"></a>Complex multiplication and division follow Fortran rules. Range 1899reduction is done as part of complex division, but there is no checking 1900whether the result of a complex multiplication or division is <code>NaN 1901+ I*NaN</code>, with an attempt to rescue the situation in that case. 1902 1903 <p>The default is <samp><span class="option">-fno-cx-fortran-rules</span></samp>. 1904 1905 </dl> 1906 1907 <p>The following options control optimizations that may improve 1908performance, but are not enabled by any <samp><span class="option">-O</span></samp> options. This 1909section includes experimental options that may produce broken code. 1910 1911 <dl> 1912<dt><code>-fbranch-probabilities</code><dd><a name="index-fbranch_002dprobabilities-918"></a>After running a program compiled with <samp><span class="option">-fprofile-arcs</span></samp> 1913(see <a href="Debugging-Options.html#Debugging-Options">Options for Debugging Your Program or <samp><span class="command">gcc</span></samp></a>), you can compile it a second time using 1914<samp><span class="option">-fbranch-probabilities</span></samp>, to improve optimizations based on 1915the number of times each branch was taken. When a program 1916compiled with <samp><span class="option">-fprofile-arcs</span></samp> exits, it saves arc execution 1917counts to a file called <samp><var>sourcename</var><span class="file">.gcda</span></samp> for each source 1918file. The information in this data file is very dependent on the 1919structure of the generated code, so you must use the same source code 1920and the same optimization options for both compilations. 1921 1922 <p>With <samp><span class="option">-fbranch-probabilities</span></samp>, GCC puts a 1923‘<samp><span class="samp">REG_BR_PROB</span></samp>’ note on each ‘<samp><span class="samp">JUMP_INSN</span></samp>’ and ‘<samp><span class="samp">CALL_INSN</span></samp>’. 1924These can be used to improve optimization. Currently, they are only 1925used in one place: in <samp><span class="file">reorg.c</span></samp>, instead of guessing which path a 1926branch is most likely to take, the ‘<samp><span class="samp">REG_BR_PROB</span></samp>’ values are used to 1927exactly determine which path is taken more often. 1928 1929 <br><dt><code>-fprofile-values</code><dd><a name="index-fprofile_002dvalues-919"></a>If combined with <samp><span class="option">-fprofile-arcs</span></samp>, it adds code so that some 1930data about values of expressions in the program is gathered. 1931 1932 <p>With <samp><span class="option">-fbranch-probabilities</span></samp>, it reads back the data gathered 1933from profiling values of expressions for usage in optimizations. 1934 1935 <p>Enabled with <samp><span class="option">-fprofile-generate</span></samp> and <samp><span class="option">-fprofile-use</span></samp>. 1936 1937 <br><dt><code>-fvpt</code><dd><a name="index-fvpt-920"></a>If combined with <samp><span class="option">-fprofile-arcs</span></samp>, this option instructs the compiler 1938to add code to gather information about values of expressions. 1939 1940 <p>With <samp><span class="option">-fbranch-probabilities</span></samp>, it reads back the data gathered 1941and actually performs the optimizations based on them. 1942Currently the optimizations include specialization of division operations 1943using the knowledge about the value of the denominator. 1944 1945 <br><dt><code>-frename-registers</code><dd><a name="index-frename_002dregisters-921"></a>Attempt to avoid false dependencies in scheduled code by making use 1946of registers left over after register allocation. This optimization 1947most benefits processors with lots of registers. Depending on the 1948debug information format adopted by the target, however, it can 1949make debugging impossible, since variables no longer stay in 1950a “home register”. 1951 1952 <p>Enabled by default with <samp><span class="option">-funroll-loops</span></samp> and <samp><span class="option">-fpeel-loops</span></samp>. 1953 1954 <br><dt><code>-ftracer</code><dd><a name="index-ftracer-922"></a>Perform tail duplication to enlarge superblock size. This transformation 1955simplifies the control flow of the function allowing other optimizations to do 1956a better job. 1957 1958 <p>Enabled with <samp><span class="option">-fprofile-use</span></samp>. 1959 1960 <br><dt><code>-funroll-loops</code><dd><a name="index-funroll_002dloops-923"></a>Unroll loops whose number of iterations can be determined at compile time or 1961upon entry to the loop. <samp><span class="option">-funroll-loops</span></samp> implies 1962<samp><span class="option">-frerun-cse-after-loop</span></samp>, <samp><span class="option">-fweb</span></samp> and <samp><span class="option">-frename-registers</span></samp>. 1963It also turns on complete loop peeling (i.e. complete removal of loops with 1964a small constant number of iterations). This option makes code larger, and may 1965or may not make it run faster. 1966 1967 <p>Enabled with <samp><span class="option">-fprofile-use</span></samp>. 1968 1969 <br><dt><code>-funroll-all-loops</code><dd><a name="index-funroll_002dall_002dloops-924"></a>Unroll all loops, even if their number of iterations is uncertain when 1970the loop is entered. This usually makes programs run more slowly. 1971<samp><span class="option">-funroll-all-loops</span></samp> implies the same options as 1972<samp><span class="option">-funroll-loops</span></samp>. 1973 1974 <br><dt><code>-fpeel-loops</code><dd><a name="index-fpeel_002dloops-925"></a>Peels loops for which there is enough information that they do not 1975roll much (from profile feedback). It also turns on complete loop peeling 1976(i.e. complete removal of loops with small constant number of iterations). 1977 1978 <p>Enabled with <samp><span class="option">-fprofile-use</span></samp>. 1979 1980 <br><dt><code>-fmove-loop-invariants</code><dd><a name="index-fmove_002dloop_002dinvariants-926"></a>Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 1981at level <samp><span class="option">-O1</span></samp> 1982 1983 <br><dt><code>-funswitch-loops</code><dd><a name="index-funswitch_002dloops-927"></a>Move branches with loop invariant conditions out of the loop, with duplicates 1984of the loop on both branches (modified according to result of the condition). 1985 1986 <br><dt><code>-ffunction-sections</code><dt><code>-fdata-sections</code><dd><a name="index-ffunction_002dsections-928"></a><a name="index-fdata_002dsections-929"></a>Place each function or data item into its own section in the output 1987file if the target supports arbitrary sections. The name of the 1988function or the name of the data item determines the section's name 1989in the output file. 1990 1991 <p>Use these options on systems where the linker can perform optimizations 1992to improve locality of reference in the instruction space. Most systems 1993using the ELF object format and SPARC processors running Solaris 2 have 1994linkers with such optimizations. AIX may have these optimizations in 1995the future. 1996 1997 <p>Only use these options when there are significant benefits from doing 1998so. When you specify these options, the assembler and linker 1999create larger object and executable files and are also slower. 2000You cannot use <code>gprof</code> on all systems if you 2001specify this option, and you may have problems with debugging if 2002you specify both this option and <samp><span class="option">-g</span></samp>. 2003 2004 <br><dt><code>-fbranch-target-load-optimize</code><dd><a name="index-fbranch_002dtarget_002dload_002doptimize-930"></a>Perform branch target register load optimization before prologue / epilogue 2005threading. 2006The use of target registers can typically be exposed only during reload, 2007thus hoisting loads out of loops and doing inter-block scheduling needs 2008a separate optimization pass. 2009 2010 <br><dt><code>-fbranch-target-load-optimize2</code><dd><a name="index-fbranch_002dtarget_002dload_002doptimize2-931"></a>Perform branch target register load optimization after prologue / epilogue 2011threading. 2012 2013 <br><dt><code>-fbtr-bb-exclusive</code><dd><a name="index-fbtr_002dbb_002dexclusive-932"></a>When performing branch target register load optimization, don't reuse 2014branch target registers within any basic block. 2015 2016 <br><dt><code>-fstack-protector</code><dd><a name="index-fstack_002dprotector-933"></a>Emit extra code to check for buffer overflows, such as stack smashing 2017attacks. This is done by adding a guard variable to functions with 2018vulnerable objects. This includes functions that call <code>alloca</code>, and 2019functions with buffers larger than 8 bytes. The guards are initialized 2020when a function is entered and then checked when the function exits. 2021If a guard check fails, an error message is printed and the program exits. 2022 2023 <br><dt><code>-fstack-protector-all</code><dd><a name="index-fstack_002dprotector_002dall-934"></a>Like <samp><span class="option">-fstack-protector</span></samp> except that all functions are protected. 2024 2025 <br><dt><code>-fsection-anchors</code><dd><a name="index-fsection_002danchors-935"></a>Try to reduce the number of symbolic address calculations by using 2026shared “anchor” symbols to address nearby objects. This transformation 2027can help to reduce the number of GOT entries and GOT accesses on some 2028targets. 2029 2030 <p>For example, the implementation of the following function <code>foo</code>: 2031 2032 <pre class="smallexample"> static int a, b, c; 2033 int foo (void) { return a + b + c; } 2034</pre> 2035 <p class="noindent">usually calculates the addresses of all three variables, but if you 2036compile it with <samp><span class="option">-fsection-anchors</span></samp>, it accesses the variables 2037from a common anchor point instead. The effect is similar to the 2038following pseudocode (which isn't valid C): 2039 2040 <pre class="smallexample"> int foo (void) 2041 { 2042 register int *xr = &x; 2043 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 2044 } 2045</pre> 2046 <p>Not all targets support this option. 2047 2048 <br><dt><code>--param </code><var>name</var><code>=</code><var>value</var><dd><a name="index-param-936"></a>In some places, GCC uses various constants to control the amount of 2049optimization that is done. For example, GCC does not inline functions 2050that contain more than a certain number of instructions. You can 2051control some of these constants on the command line using the 2052<samp><span class="option">--param</span></samp> option. 2053 2054 <p>The names of specific parameters, and the meaning of the values, are 2055tied to the internals of the compiler, and are subject to change 2056without notice in future releases. 2057 2058 <p>In each case, the <var>value</var> is an integer. The allowable choices for 2059<var>name</var> are: 2060 2061 <dl> 2062<dt><code>predictable-branch-outcome</code><dd>When branch is predicted to be taken with probability lower than this threshold 2063(in percent), then it is considered well predictable. The default is 10. 2064 2065 <br><dt><code>max-crossjump-edges</code><dd>The maximum number of incoming edges to consider for cross-jumping. 2066The algorithm used by <samp><span class="option">-fcrossjumping</span></samp> is O(N^2) in 2067the number of edges incoming to each block. Increasing values mean 2068more aggressive optimization, making the compilation time increase with 2069probably small improvement in executable size. 2070 2071 <br><dt><code>min-crossjump-insns</code><dd>The minimum number of instructions that must be matched at the end 2072of two blocks before cross-jumping is performed on them. This 2073value is ignored in the case where all instructions in the block being 2074cross-jumped from are matched. The default value is 5. 2075 2076 <br><dt><code>max-grow-copy-bb-insns</code><dd>The maximum code size expansion factor when copying basic blocks 2077instead of jumping. The expansion is relative to a jump instruction. 2078The default value is 8. 2079 2080 <br><dt><code>max-goto-duplication-insns</code><dd>The maximum number of instructions to duplicate to a block that jumps 2081to a computed goto. To avoid O(N^2) behavior in a number of 2082passes, GCC factors computed gotos early in the compilation process, 2083and unfactors them as late as possible. Only computed jumps at the 2084end of a basic blocks with no more than max-goto-duplication-insns are 2085unfactored. The default value is 8. 2086 2087 <br><dt><code>max-delay-slot-insn-search</code><dd>The maximum number of instructions to consider when looking for an 2088instruction to fill a delay slot. If more than this arbitrary number of 2089instructions are searched, the time savings from filling the delay slot 2090are minimal, so stop searching. Increasing values mean more 2091aggressive optimization, making the compilation time increase with probably 2092small improvement in execution time. 2093 2094 <br><dt><code>max-delay-slot-live-search</code><dd>When trying to fill delay slots, the maximum number of instructions to 2095consider when searching for a block with valid live register 2096information. Increasing this arbitrarily chosen value means more 2097aggressive optimization, increasing the compilation time. This parameter 2098should be removed when the delay slot code is rewritten to maintain the 2099control-flow graph. 2100 2101 <br><dt><code>max-gcse-memory</code><dd>The approximate maximum amount of memory that can be allocated in 2102order to perform the global common subexpression elimination 2103optimization. If more memory than specified is required, the 2104optimization is not done. 2105 2106 <br><dt><code>max-gcse-insertion-ratio</code><dd>If the ratio of expression insertions to deletions is larger than this value 2107for any expression, then RTL PRE inserts or removes the expression and thus 2108leaves partially redundant computations in the instruction stream. The default value is 20. 2109 2110 <br><dt><code>max-pending-list-length</code><dd>The maximum number of pending dependencies scheduling allows 2111before flushing the current state and starting over. Large functions 2112with few branches or calls can create excessively large lists which 2113needlessly consume memory and resources. 2114 2115 <br><dt><code>max-modulo-backtrack-attempts</code><dd>The maximum number of backtrack attempts the scheduler should make 2116when modulo scheduling a loop. Larger values can exponentially increase 2117compilation time. 2118 2119 <br><dt><code>max-inline-insns-single</code><dd>Several parameters control the tree inliner used in GCC. 2120This number sets the maximum number of instructions (counted in GCC's 2121internal representation) in a single function that the tree inliner 2122considers for inlining. This only affects functions declared 2123inline and methods implemented in a class declaration (C++). 2124The default value is 400. 2125 2126 <br><dt><code>max-inline-insns-auto</code><dd>When you use <samp><span class="option">-finline-functions</span></samp> (included in <samp><span class="option">-O3</span></samp>), 2127a lot of functions that would otherwise not be considered for inlining 2128by the compiler are investigated. To those functions, a different 2129(more restrictive) limit compared to functions declared inline can 2130be applied. 2131The default value is 40. 2132 2133 <br><dt><code>inline-min-speedup</code><dd>When estimated performance improvement of caller + callee runtime exceeds this 2134threshold (in precent), the function can be inlined regardless the limit on 2135<samp><span class="option">--param max-inline-insns-single</span></samp> and <samp><span class="option">--param 2136max-inline-insns-auto</span></samp>. 2137 2138 <br><dt><code>large-function-insns</code><dd>The limit specifying really large functions. For functions larger than this 2139limit after inlining, inlining is constrained by 2140<samp><span class="option">--param large-function-growth</span></samp>. This parameter is useful primarily 2141to avoid extreme compilation time caused by non-linear algorithms used by the 2142back end. 2143The default value is 2700. 2144 2145 <br><dt><code>large-function-growth</code><dd>Specifies maximal growth of large function caused by inlining in percents. 2146The default value is 100 which limits large function growth to 2.0 times 2147the original size. 2148 2149 <br><dt><code>large-unit-insns</code><dd>The limit specifying large translation unit. Growth caused by inlining of 2150units larger than this limit is limited by <samp><span class="option">--param inline-unit-growth</span></samp>. 2151For small units this might be too tight. 2152For example, consider a unit consisting of function A 2153that is inline and B that just calls A three times. If B is small relative to 2154A, the growth of unit is 300\% and yet such inlining is very sane. For very 2155large units consisting of small inlineable functions, however, the overall unit 2156growth limit is needed to avoid exponential explosion of code size. Thus for 2157smaller units, the size is increased to <samp><span class="option">--param large-unit-insns</span></samp> 2158before applying <samp><span class="option">--param inline-unit-growth</span></samp>. The default is 10000. 2159 2160 <br><dt><code>inline-unit-growth</code><dd>Specifies maximal overall growth of the compilation unit caused by inlining. 2161The default value is 30 which limits unit growth to 1.3 times the original 2162size. 2163 2164 <br><dt><code>ipcp-unit-growth</code><dd>Specifies maximal overall growth of the compilation unit caused by 2165interprocedural constant propagation. The default value is 10 which limits 2166unit growth to 1.1 times the original size. 2167 2168 <br><dt><code>large-stack-frame</code><dd>The limit specifying large stack frames. While inlining the algorithm is trying 2169to not grow past this limit too much. The default value is 256 bytes. 2170 2171 <br><dt><code>large-stack-frame-growth</code><dd>Specifies maximal growth of large stack frames caused by inlining in percents. 2172The default value is 1000 which limits large stack frame growth to 11 times 2173the original size. 2174 2175 <br><dt><code>max-inline-insns-recursive</code><dt><code>max-inline-insns-recursive-auto</code><dd>Specifies the maximum number of instructions an out-of-line copy of a 2176self-recursive inline 2177function can grow into by performing recursive inlining. 2178 2179 <p>For functions declared inline, <samp><span class="option">--param max-inline-insns-recursive</span></samp> is 2180taken into account. For functions not declared inline, recursive inlining 2181happens only when <samp><span class="option">-finline-functions</span></samp> (included in <samp><span class="option">-O3</span></samp>) is 2182enabled and <samp><span class="option">--param max-inline-insns-recursive-auto</span></samp> is used. The 2183default value is 450. 2184 2185 <br><dt><code>max-inline-recursive-depth</code><dt><code>max-inline-recursive-depth-auto</code><dd>Specifies the maximum recursion depth used for recursive inlining. 2186 2187 <p>For functions declared inline, <samp><span class="option">--param max-inline-recursive-depth</span></samp> is 2188taken into account. For functions not declared inline, recursive inlining 2189happens only when <samp><span class="option">-finline-functions</span></samp> (included in <samp><span class="option">-O3</span></samp>) is 2190enabled and <samp><span class="option">--param max-inline-recursive-depth-auto</span></samp> is used. The 2191default value is 8. 2192 2193 <br><dt><code>min-inline-recursive-probability</code><dd>Recursive inlining is profitable only for function having deep recursion 2194in average and can hurt for function having little recursion depth by 2195increasing the prologue size or complexity of function body to other 2196optimizers. 2197 2198 <p>When profile feedback is available (see <samp><span class="option">-fprofile-generate</span></samp>) the actual 2199recursion depth can be guessed from probability that function recurses via a 2200given call expression. This parameter limits inlining only to call expressions 2201whose probability exceeds the given threshold (in percents). 2202The default value is 10. 2203 2204 <br><dt><code>early-inlining-insns</code><dd>Specify growth that the early inliner can make. In effect it increases 2205the amount of inlining for code having a large abstraction penalty. 2206The default value is 10. 2207 2208 <br><dt><code>max-early-inliner-iterations</code><dt><code>max-early-inliner-iterations</code><dd>Limit of iterations of the early inliner. This basically bounds 2209the number of nested indirect calls the early inliner can resolve. 2210Deeper chains are still handled by late inlining. 2211 2212 <br><dt><code>comdat-sharing-probability</code><dt><code>comdat-sharing-probability</code><dd>Probability (in percent) that C++ inline function with comdat visibility 2213are shared across multiple compilation units. The default value is 20. 2214 2215 <br><dt><code>min-vect-loop-bound</code><dd>The minimum number of iterations under which loops are not vectorized 2216when <samp><span class="option">-ftree-vectorize</span></samp> is used. The number of iterations after 2217vectorization needs to be greater than the value specified by this option 2218to allow vectorization. The default value is 0. 2219 2220 <br><dt><code>gcse-cost-distance-ratio</code><dd>Scaling factor in calculation of maximum distance an expression 2221can be moved by GCSE optimizations. This is currently supported only in the 2222code hoisting pass. The bigger the ratio, the more aggressive code hoisting 2223is with simple expressions, i.e., the expressions that have cost 2224less than <samp><span class="option">gcse-unrestricted-cost</span></samp>. Specifying 0 disables 2225hoisting of simple expressions. The default value is 10. 2226 2227 <br><dt><code>gcse-unrestricted-cost</code><dd>Cost, roughly measured as the cost of a single typical machine 2228instruction, at which GCSE optimizations do not constrain 2229the distance an expression can travel. This is currently 2230supported only in the code hoisting pass. The lesser the cost, 2231the more aggressive code hoisting is. Specifying 0 2232allows all expressions to travel unrestricted distances. 2233The default value is 3. 2234 2235 <br><dt><code>max-hoist-depth</code><dd>The depth of search in the dominator tree for expressions to hoist. 2236This is used to avoid quadratic behavior in hoisting algorithm. 2237The value of 0 does not limit on the search, but may slow down compilation 2238of huge functions. The default value is 30. 2239 2240 <br><dt><code>max-tail-merge-comparisons</code><dd>The maximum amount of similar bbs to compare a bb with. This is used to 2241avoid quadratic behavior in tree tail merging. The default value is 10. 2242 2243 <br><dt><code>max-tail-merge-iterations</code><dd>The maximum amount of iterations of the pass over the function. This is used to 2244limit compilation time in tree tail merging. The default value is 2. 2245 2246 <br><dt><code>max-unrolled-insns</code><dd>The maximum number of instructions that a loop may have to be unrolled. 2247If a loop is unrolled, this parameter also determines how many times 2248the loop code is unrolled. 2249 2250 <br><dt><code>max-average-unrolled-insns</code><dd>The maximum number of instructions biased by probabilities of their execution 2251that a loop may have to be unrolled. If a loop is unrolled, 2252this parameter also determines how many times the loop code is unrolled. 2253 2254 <br><dt><code>max-unroll-times</code><dd>The maximum number of unrollings of a single loop. 2255 2256 <br><dt><code>max-peeled-insns</code><dd>The maximum number of instructions that a loop may have to be peeled. 2257If a loop is peeled, this parameter also determines how many times 2258the loop code is peeled. 2259 2260 <br><dt><code>max-peel-times</code><dd>The maximum number of peelings of a single loop. 2261 2262 <br><dt><code>max-peel-branches</code><dd>The maximum number of branches on the hot path through the peeled sequence. 2263 2264 <br><dt><code>max-completely-peeled-insns</code><dd>The maximum number of insns of a completely peeled loop. 2265 2266 <br><dt><code>max-completely-peel-times</code><dd>The maximum number of iterations of a loop to be suitable for complete peeling. 2267 2268 <br><dt><code>max-completely-peel-loop-nest-depth</code><dd>The maximum depth of a loop nest suitable for complete peeling. 2269 2270 <br><dt><code>max-unswitch-insns</code><dd>The maximum number of insns of an unswitched loop. 2271 2272 <br><dt><code>max-unswitch-level</code><dd>The maximum number of branches unswitched in a single loop. 2273 2274 <br><dt><code>lim-expensive</code><dd>The minimum cost of an expensive expression in the loop invariant motion. 2275 2276 <br><dt><code>iv-consider-all-candidates-bound</code><dd>Bound on number of candidates for induction variables, below which 2277all candidates are considered for each use in induction variable 2278optimizations. If there are more candidates than this, 2279only the most relevant ones are considered to avoid quadratic time complexity. 2280 2281 <br><dt><code>iv-max-considered-uses</code><dd>The induction variable optimizations give up on loops that contain more 2282induction variable uses. 2283 2284 <br><dt><code>iv-always-prune-cand-set-bound</code><dd>If the number of candidates in the set is smaller than this value, 2285always try to remove unnecessary ivs from the set 2286when adding a new one. 2287 2288 <br><dt><code>scev-max-expr-size</code><dd>Bound on size of expressions used in the scalar evolutions analyzer. 2289Large expressions slow the analyzer. 2290 2291 <br><dt><code>scev-max-expr-complexity</code><dd>Bound on the complexity of the expressions in the scalar evolutions analyzer. 2292Complex expressions slow the analyzer. 2293 2294 <br><dt><code>omega-max-vars</code><dd>The maximum number of variables in an Omega constraint system. 2295The default value is 128. 2296 2297 <br><dt><code>omega-max-geqs</code><dd>The maximum number of inequalities in an Omega constraint system. 2298The default value is 256. 2299 2300 <br><dt><code>omega-max-eqs</code><dd>The maximum number of equalities in an Omega constraint system. 2301The default value is 128. 2302 2303 <br><dt><code>omega-max-wild-cards</code><dd>The maximum number of wildcard variables that the Omega solver is 2304able to insert. The default value is 18. 2305 2306 <br><dt><code>omega-hash-table-size</code><dd>The size of the hash table in the Omega solver. The default value is 2307550. 2308 2309 <br><dt><code>omega-max-keys</code><dd>The maximal number of keys used by the Omega solver. The default 2310value is 500. 2311 2312 <br><dt><code>omega-eliminate-redundant-constraints</code><dd>When set to 1, use expensive methods to eliminate all redundant 2313constraints. The default value is 0. 2314 2315 <br><dt><code>vect-max-version-for-alignment-checks</code><dd>The maximum number of run-time checks that can be performed when 2316doing loop versioning for alignment in the vectorizer. See option 2317<samp><span class="option">-ftree-vect-loop-version</span></samp> for more information. 2318 2319 <br><dt><code>vect-max-version-for-alias-checks</code><dd>The maximum number of run-time checks that can be performed when 2320doing loop versioning for alias in the vectorizer. See option 2321<samp><span class="option">-ftree-vect-loop-version</span></samp> for more information. 2322 2323 <br><dt><code>max-iterations-to-track</code><dd>The maximum number of iterations of a loop the brute-force algorithm 2324for analysis of the number of iterations of the loop tries to evaluate. 2325 2326 <br><dt><code>hot-bb-count-ws-permille</code><dd>A basic block profile count is considered hot if it contributes to 2327the given permillage (i.e. 0...1000) of the entire profiled execution. 2328 2329 <br><dt><code>hot-bb-frequency-fraction</code><dd>Select fraction of the entry block frequency of executions of basic block in 2330function given basic block needs to have to be considered hot. 2331 2332 <br><dt><code>max-predicted-iterations</code><dd>The maximum number of loop iterations we predict statically. This is useful 2333in cases where a function contains a single loop with known bound and 2334another loop with unknown bound. 2335The known number of iterations is predicted correctly, while 2336the unknown number of iterations average to roughly 10. This means that the 2337loop without bounds appears artificially cold relative to the other one. 2338 2339 <br><dt><code>align-threshold</code><dd> 2340Select fraction of the maximal frequency of executions of a basic block in 2341a function to align the basic block. 2342 2343 <br><dt><code>align-loop-iterations</code><dd> 2344A loop expected to iterate at least the selected number of iterations is 2345aligned. 2346 2347 <br><dt><code>tracer-dynamic-coverage</code><dt><code>tracer-dynamic-coverage-feedback</code><dd> 2348This value is used to limit superblock formation once the given percentage of 2349executed instructions is covered. This limits unnecessary code size 2350expansion. 2351 2352 <p>The <samp><span class="option">tracer-dynamic-coverage-feedback</span></samp> is used only when profile 2353feedback is available. The real profiles (as opposed to statically estimated 2354ones) are much less balanced allowing the threshold to be larger value. 2355 2356 <br><dt><code>tracer-max-code-growth</code><dd>Stop tail duplication once code growth has reached given percentage. This is 2357a rather artificial limit, as most of the duplicates are eliminated later in 2358cross jumping, so it may be set to much higher values than is the desired code 2359growth. 2360 2361 <br><dt><code>tracer-min-branch-ratio</code><dd> 2362Stop reverse growth when the reverse probability of best edge is less than this 2363threshold (in percent). 2364 2365 <br><dt><code>tracer-min-branch-ratio</code><dt><code>tracer-min-branch-ratio-feedback</code><dd> 2366Stop forward growth if the best edge has probability lower than this 2367threshold. 2368 2369 <p>Similarly to <samp><span class="option">tracer-dynamic-coverage</span></samp> two values are present, one for 2370compilation for profile feedback and one for compilation without. The value 2371for compilation with profile feedback needs to be more conservative (higher) in 2372order to make tracer effective. 2373 2374 <br><dt><code>max-cse-path-length</code><dd> 2375The maximum number of basic blocks on path that CSE considers. 2376The default is 10. 2377 2378 <br><dt><code>max-cse-insns</code><dd>The maximum number of instructions CSE processes before flushing. 2379The default is 1000. 2380 2381 <br><dt><code>ggc-min-expand</code><dd> 2382GCC uses a garbage collector to manage its own memory allocation. This 2383parameter specifies the minimum percentage by which the garbage 2384collector's heap should be allowed to expand between collections. 2385Tuning this may improve compilation speed; it has no effect on code 2386generation. 2387 2388 <p>The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 2389RAM >= 1GB. If <code>getrlimit</code> is available, the notion of “RAM” is 2390the smallest of actual RAM and <code>RLIMIT_DATA</code> or <code>RLIMIT_AS</code>. If 2391GCC is not able to calculate RAM on a particular platform, the lower 2392bound of 30% is used. Setting this parameter and 2393<samp><span class="option">ggc-min-heapsize</span></samp> to zero causes a full collection to occur at 2394every opportunity. This is extremely slow, but can be useful for 2395debugging. 2396 2397 <br><dt><code>ggc-min-heapsize</code><dd> 2398Minimum size of the garbage collector's heap before it begins bothering 2399to collect garbage. The first collection occurs after the heap expands 2400by <samp><span class="option">ggc-min-expand</span></samp>% beyond <samp><span class="option">ggc-min-heapsize</span></samp>. Again, 2401tuning this may improve compilation speed, and has no effect on code 2402generation. 2403 2404 <p>The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that 2405tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 2406with a lower bound of 4096 (four megabytes) and an upper bound of 2407131072 (128 megabytes). If GCC is not able to calculate RAM on a 2408particular platform, the lower bound is used. Setting this parameter 2409very large effectively disables garbage collection. Setting this 2410parameter and <samp><span class="option">ggc-min-expand</span></samp> to zero causes a full collection 2411to occur at every opportunity. 2412 2413 <br><dt><code>max-reload-search-insns</code><dd>The maximum number of instruction reload should look backward for equivalent 2414register. Increasing values mean more aggressive optimization, making the 2415compilation time increase with probably slightly better performance. 2416The default value is 100. 2417 2418 <br><dt><code>max-cselib-memory-locations</code><dd>The maximum number of memory locations cselib should take into account. 2419Increasing values mean more aggressive optimization, making the compilation time 2420increase with probably slightly better performance. The default value is 500. 2421 2422 <br><dt><code>reorder-blocks-duplicate</code><dt><code>reorder-blocks-duplicate-feedback</code><dd> 2423Used by the basic block reordering pass to decide whether to use unconditional 2424branch or duplicate the code on its destination. Code is duplicated when its 2425estimated size is smaller than this value multiplied by the estimated size of 2426unconditional jump in the hot spots of the program. 2427 2428 <p>The <samp><span class="option">reorder-block-duplicate-feedback</span></samp> is used only when profile 2429feedback is available. It may be set to higher values than 2430<samp><span class="option">reorder-block-duplicate</span></samp> since information about the hot spots is more 2431accurate. 2432 2433 <br><dt><code>max-sched-ready-insns</code><dd>The maximum number of instructions ready to be issued the scheduler should 2434consider at any given time during the first scheduling pass. Increasing 2435values mean more thorough searches, making the compilation time increase 2436with probably little benefit. The default value is 100. 2437 2438 <br><dt><code>max-sched-region-blocks</code><dd>The maximum number of blocks in a region to be considered for 2439interblock scheduling. The default value is 10. 2440 2441 <br><dt><code>max-pipeline-region-blocks</code><dd>The maximum number of blocks in a region to be considered for 2442pipelining in the selective scheduler. The default value is 15. 2443 2444 <br><dt><code>max-sched-region-insns</code><dd>The maximum number of insns in a region to be considered for 2445interblock scheduling. The default value is 100. 2446 2447 <br><dt><code>max-pipeline-region-insns</code><dd>The maximum number of insns in a region to be considered for 2448pipelining in the selective scheduler. The default value is 200. 2449 2450 <br><dt><code>min-spec-prob</code><dd>The minimum probability (in percents) of reaching a source block 2451for interblock speculative scheduling. The default value is 40. 2452 2453 <br><dt><code>max-sched-extend-regions-iters</code><dd>The maximum number of iterations through CFG to extend regions. 2454A value of 0 (the default) disables region extensions. 2455 2456 <br><dt><code>max-sched-insn-conflict-delay</code><dd>The maximum conflict delay for an insn to be considered for speculative motion. 2457The default value is 3. 2458 2459 <br><dt><code>sched-spec-prob-cutoff</code><dd>The minimal probability of speculation success (in percents), so that 2460speculative insns are scheduled. 2461The default value is 40. 2462 2463 <br><dt><code>sched-spec-state-edge-prob-cutoff</code><dd>The minimum probability an edge must have for the scheduler to save its 2464state across it. 2465The default value is 10. 2466 2467 <br><dt><code>sched-mem-true-dep-cost</code><dd>Minimal distance (in CPU cycles) between store and load targeting same 2468memory locations. The default value is 1. 2469 2470 <br><dt><code>selsched-max-lookahead</code><dd>The maximum size of the lookahead window of selective scheduling. It is a 2471depth of search for available instructions. 2472The default value is 50. 2473 2474 <br><dt><code>selsched-max-sched-times</code><dd>The maximum number of times that an instruction is scheduled during 2475selective scheduling. This is the limit on the number of iterations 2476through which the instruction may be pipelined. The default value is 2. 2477 2478 <br><dt><code>selsched-max-insns-to-rename</code><dd>The maximum number of best instructions in the ready list that are considered 2479for renaming in the selective scheduler. The default value is 2. 2480 2481 <br><dt><code>sms-min-sc</code><dd>The minimum value of stage count that swing modulo scheduler 2482generates. The default value is 2. 2483 2484 <br><dt><code>max-last-value-rtl</code><dd>The maximum size measured as number of RTLs that can be recorded in an expression 2485in combiner for a pseudo register as last known value of that register. The default 2486is 10000. 2487 2488 <br><dt><code>integer-share-limit</code><dd>Small integer constants can use a shared data structure, reducing the 2489compiler's memory usage and increasing its speed. This sets the maximum 2490value of a shared integer constant. The default value is 256. 2491 2492 <br><dt><code>ssp-buffer-size</code><dd>The minimum size of buffers (i.e. arrays) that receive stack smashing 2493protection when <samp><span class="option">-fstack-protection</span></samp> is used. 2494 2495 <br><dt><code>max-jump-thread-duplication-stmts</code><dd>Maximum number of statements allowed in a block that needs to be 2496duplicated when threading jumps. 2497 2498 <br><dt><code>max-fields-for-field-sensitive</code><dd>Maximum number of fields in a structure treated in 2499a field sensitive manner during pointer analysis. The default is zero 2500for <samp><span class="option">-O0</span></samp> and <samp><span class="option">-O1</span></samp>, 2501and 100 for <samp><span class="option">-Os</span></samp>, <samp><span class="option">-O2</span></samp>, and <samp><span class="option">-O3</span></samp>. 2502 2503 <br><dt><code>prefetch-latency</code><dd>Estimate on average number of instructions that are executed before 2504prefetch finishes. The distance prefetched ahead is proportional 2505to this constant. Increasing this number may also lead to less 2506streams being prefetched (see <samp><span class="option">simultaneous-prefetches</span></samp>). 2507 2508 <br><dt><code>simultaneous-prefetches</code><dd>Maximum number of prefetches that can run at the same time. 2509 2510 <br><dt><code>l1-cache-line-size</code><dd>The size of cache line in L1 cache, in bytes. 2511 2512 <br><dt><code>l1-cache-size</code><dd>The size of L1 cache, in kilobytes. 2513 2514 <br><dt><code>l2-cache-size</code><dd>The size of L2 cache, in kilobytes. 2515 2516 <br><dt><code>min-insn-to-prefetch-ratio</code><dd>The minimum ratio between the number of instructions and the 2517number of prefetches to enable prefetching in a loop. 2518 2519 <br><dt><code>prefetch-min-insn-to-mem-ratio</code><dd>The minimum ratio between the number of instructions and the 2520number of memory references to enable prefetching in a loop. 2521 2522 <br><dt><code>use-canonical-types</code><dd>Whether the compiler should use the “canonical” type system. By 2523default, this should always be 1, which uses a more efficient internal 2524mechanism for comparing types in C++ and Objective-C++. However, if 2525bugs in the canonical type system are causing compilation failures, 2526set this value to 0 to disable canonical types. 2527 2528 <br><dt><code>switch-conversion-max-branch-ratio</code><dd>Switch initialization conversion refuses to create arrays that are 2529bigger than <samp><span class="option">switch-conversion-max-branch-ratio</span></samp> times the number of 2530branches in the switch. 2531 2532 <br><dt><code>max-partial-antic-length</code><dd>Maximum length of the partial antic set computed during the tree 2533partial redundancy elimination optimization (<samp><span class="option">-ftree-pre</span></samp>) when 2534optimizing at <samp><span class="option">-O3</span></samp> and above. For some sorts of source code 2535the enhanced partial redundancy elimination optimization can run away, 2536consuming all of the memory available on the host machine. This 2537parameter sets a limit on the length of the sets that are computed, 2538which prevents the runaway behavior. Setting a value of 0 for 2539this parameter allows an unlimited set length. 2540 2541 <br><dt><code>sccvn-max-scc-size</code><dd>Maximum size of a strongly connected component (SCC) during SCCVN 2542processing. If this limit is hit, SCCVN processing for the whole 2543function is not done and optimizations depending on it are 2544disabled. The default maximum SCC size is 10000. 2545 2546 <br><dt><code>sccvn-max-alias-queries-per-access</code><dd>Maximum number of alias-oracle queries we perform when looking for 2547redundancies for loads and stores. If this limit is hit the search 2548is aborted and the load or store is not considered redundant. The 2549number of queries is algorithmically limited to the number of 2550stores on all paths from the load to the function entry. 2551The default maxmimum number of queries is 1000. 2552 2553 <br><dt><code>ira-max-loops-num</code><dd>IRA uses regional register allocation by default. If a function 2554contains more loops than the number given by this parameter, only at most 2555the given number of the most frequently-executed loops form regions 2556for regional register allocation. The default value of the 2557parameter is 100. 2558 2559 <br><dt><code>ira-max-conflict-table-size</code><dd>Although IRA uses a sophisticated algorithm to compress the conflict 2560table, the table can still require excessive amounts of memory for 2561huge functions. If the conflict table for a function could be more 2562than the size in MB given by this parameter, the register allocator 2563instead uses a faster, simpler, and lower-quality 2564algorithm that does not require building a pseudo-register conflict table. 2565The default value of the parameter is 2000. 2566 2567 <br><dt><code>ira-loop-reserved-regs</code><dd>IRA can be used to evaluate more accurate register pressure in loops 2568for decisions to move loop invariants (see <samp><span class="option">-O3</span></samp>). The number 2569of available registers reserved for some other purposes is given 2570by this parameter. The default value of the parameter is 2, which is 2571the minimal number of registers needed by typical instructions. 2572This value is the best found from numerous experiments. 2573 2574 <br><dt><code>loop-invariant-max-bbs-in-loop</code><dd>Loop invariant motion can be very expensive, both in compilation time and 2575in amount of needed compile-time memory, with very large loops. Loops 2576with more basic blocks than this parameter won't have loop invariant 2577motion optimization performed on them. The default value of the 2578parameter is 1000 for <samp><span class="option">-O1</span></samp> and 10000 for <samp><span class="option">-O2</span></samp> and above. 2579 2580 <br><dt><code>loop-max-datarefs-for-datadeps</code><dd>Building data dapendencies is expensive for very large loops. This 2581parameter limits the number of data references in loops that are 2582considered for data dependence analysis. These large loops are no 2583handled by the optimizations using loop data dependencies. 2584The default value is 1000. 2585 2586 <br><dt><code>max-vartrack-size</code><dd>Sets a maximum number of hash table slots to use during variable 2587tracking dataflow analysis of any function. If this limit is exceeded 2588with variable tracking at assignments enabled, analysis for that 2589function is retried without it, after removing all debug insns from 2590the function. If the limit is exceeded even without debug insns, var 2591tracking analysis is completely disabled for the function. Setting 2592the parameter to zero makes it unlimited. 2593 2594 <br><dt><code>max-vartrack-expr-depth</code><dd>Sets a maximum number of recursion levels when attempting to map 2595variable names or debug temporaries to value expressions. This trades 2596compilation time for more complete debug information. If this is set too 2597low, value expressions that are available and could be represented in 2598debug information may end up not being used; setting this higher may 2599enable the compiler to find more complex debug expressions, but compile 2600time and memory use may grow. The default is 12. 2601 2602 <br><dt><code>min-nondebug-insn-uid</code><dd>Use uids starting at this parameter for nondebug insns. The range below 2603the parameter is reserved exclusively for debug insns created by 2604<samp><span class="option">-fvar-tracking-assignments</span></samp>, but debug insns may get 2605(non-overlapping) uids above it if the reserved range is exhausted. 2606 2607 <br><dt><code>ipa-sra-ptr-growth-factor</code><dd>IPA-SRA replaces a pointer to an aggregate with one or more new 2608parameters only when their cumulative size is less or equal to 2609<samp><span class="option">ipa-sra-ptr-growth-factor</span></samp> times the size of the original 2610pointer parameter. 2611 2612 <br><dt><code>tm-max-aggregate-size</code><dd>When making copies of thread-local variables in a transaction, this 2613parameter specifies the size in bytes after which variables are 2614saved with the logging functions as opposed to save/restore code 2615sequence pairs. This option only applies when using 2616<samp><span class="option">-fgnu-tm</span></samp>. 2617 2618 <br><dt><code>graphite-max-nb-scop-params</code><dd>To avoid exponential effects in the Graphite loop transforms, the 2619number of parameters in a Static Control Part (SCoP) is bounded. The 2620default value is 10 parameters. A variable whose value is unknown at 2621compilation time and defined outside a SCoP is a parameter of the SCoP. 2622 2623 <br><dt><code>graphite-max-bbs-per-function</code><dd>To avoid exponential effects in the detection of SCoPs, the size of 2624the functions analyzed by Graphite is bounded. The default value is 2625100 basic blocks. 2626 2627 <br><dt><code>loop-block-tile-size</code><dd>Loop blocking or strip mining transforms, enabled with 2628<samp><span class="option">-floop-block</span></samp> or <samp><span class="option">-floop-strip-mine</span></samp>, strip mine each 2629loop in the loop nest by a given number of iterations. The strip 2630length can be changed using the <samp><span class="option">loop-block-tile-size</span></samp> 2631parameter. The default value is 51 iterations. 2632 2633 <br><dt><code>ipa-cp-value-list-size</code><dd>IPA-CP attempts to track all possible values and types passed to a function's 2634parameter in order to propagate them and perform devirtualization. 2635<samp><span class="option">ipa-cp-value-list-size</span></samp> is the maximum number of values and types it 2636stores per one formal parameter of a function. 2637 2638 <br><dt><code>lto-partitions</code><dd>Specify desired number of partitions produced during WHOPR compilation. 2639The number of partitions should exceed the number of CPUs used for compilation. 2640The default value is 32. 2641 2642 <br><dt><code>lto-minpartition</code><dd>Size of minimal partition for WHOPR (in estimated instructions). 2643This prevents expenses of splitting very small programs into too many 2644partitions. 2645 2646 <br><dt><code>cxx-max-namespaces-for-diagnostic-help</code><dd>The maximum number of namespaces to consult for suggestions when C++ 2647name lookup fails for an identifier. The default is 1000. 2648 2649 <br><dt><code>sink-frequency-threshold</code><dd>The maximum relative execution frequency (in percents) of the target block 2650relative to a statement's original block to allow statement sinking of a 2651statement. Larger numbers result in more aggressive statement sinking. 2652The default value is 75. A small positive adjustment is applied for 2653statements with memory operands as those are even more profitable so sink. 2654 2655 <br><dt><code>max-stores-to-sink</code><dd>The maximum number of conditional stores paires that can be sunk. Set to 0 2656if either vectorization (<samp><span class="option">-ftree-vectorize</span></samp>) or if-conversion 2657(<samp><span class="option">-ftree-loop-if-convert</span></samp>) is disabled. The default is 2. 2658 2659 <br><dt><code>allow-load-data-races</code><dd>Allow optimizers to introduce new data races on loads. 2660Set to 1 to allow, otherwise to 0. This option is enabled by default 2661unless implicitly set by the <samp><span class="option">-fmemory-model=</span></samp> option. 2662 2663 <br><dt><code>allow-store-data-races</code><dd>Allow optimizers to introduce new data races on stores. 2664Set to 1 to allow, otherwise to 0. This option is enabled by default 2665unless implicitly set by the <samp><span class="option">-fmemory-model=</span></samp> option. 2666 2667 <br><dt><code>allow-packed-load-data-races</code><dd>Allow optimizers to introduce new data races on packed data loads. 2668Set to 1 to allow, otherwise to 0. This option is enabled by default 2669unless implicitly set by the <samp><span class="option">-fmemory-model=</span></samp> option. 2670 2671 <br><dt><code>allow-packed-store-data-races</code><dd>Allow optimizers to introduce new data races on packed data stores. 2672Set to 1 to allow, otherwise to 0. This option is enabled by default 2673unless implicitly set by the <samp><span class="option">-fmemory-model=</span></samp> option. 2674 2675 <br><dt><code>case-values-threshold</code><dd>The smallest number of different values for which it is best to use a 2676jump-table instead of a tree of conditional branches. If the value is 26770, use the default for the machine. The default is 0. 2678 2679 <br><dt><code>tree-reassoc-width</code><dd>Set the maximum number of instructions executed in parallel in 2680reassociated tree. This parameter overrides target dependent 2681heuristics used by default if has non zero value. 2682 2683 <br><dt><code>sched-pressure-algorithm</code><dd>Choose between the two available implementations of 2684<samp><span class="option">-fsched-pressure</span></samp>. Algorithm 1 is the original implementation 2685and is the more likely to prevent instructions from being reordered. 2686Algorithm 2 was designed to be a compromise between the relatively 2687conservative approach taken by algorithm 1 and the rather aggressive 2688approach taken by the default scheduler. It relies more heavily on 2689having a regular register file and accurate register pressure classes. 2690See <samp><span class="file">haifa-sched.c</span></samp> in the GCC sources for more details. 2691 2692 <p>The default choice depends on the target. 2693 2694 <br><dt><code>max-slsr-cand-scan</code><dd>Set the maximum number of existing candidates that will be considered when 2695seeking a basis for a new straight-line strength reduction candidate. 2696 2697 </dl> 2698 </dl> 2699 2700 </body></html> 2701 2702