From: Sandra Loosemore Date: Wed, 14 Nov 2018 20:05:13 +0000 (-0500) Subject: re PR middle-end/59658 (Document -f* flags enabled by -Og) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ded7b411a896034096b8896681ee2e3329d4c946;p=gcc.git re PR middle-end/59658 (Document -f* flags enabled by -Og) 2018-11-14 Sandra Loosemore PR middle-end/59658 gcc/ * doc/invoke.texi (Optimize Options): Clarify that -O0 and -Og also suppress many optimizations. Alphabetize option lists for -O1, -O2, and -Os. Add list of options disabled with -Og, and correct documentation for those options to say that. * opts.c (default_options_table): Sort table by level and option name, to make it easier to correlate to the manual. From-SVN: r266162 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 117e96f0b71..36c0907c61b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2018-11-14 Sandra Loosemore + + PR middle-end/59658 + * doc/invoke.texi (Optimize Options): Clarify that -O0 and -Og + also suppress many optimizations. Alphabetize option lists for + -O1, -O2, and -Os. Add list of options disabled with -Og, and + correct documentation for those options to say that. + * opts.c (default_options_table): Sort table by level and option + name, to make it easier to correlate to the manual. + 2018-11-14 Uros Bizjak * config/i386/i386.c (ix86_print_operand_address_as): Simplify diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index ea730b61c05..ed7ef004493 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -7897,9 +7897,10 @@ each of them. Not all optimizations are controlled directly by a flag. Only optimizations that have a flag are listed in this section. -Most optimizations are only enabled if an @option{-O} level is set on -the command line. Otherwise they are disabled, even if individual -optimization flags are specified. +Most optimizations are completely disabled at @option{-O0} or if an +@option{-O} level is not set on the command line, even if individual +optimization flags are specified. Similarly, @option{-Og} suppresses +many optimization passes. Depending on the target and how GCC was configured, a slightly different set of optimizations may be enabled at each @option{-O} level than @@ -7919,9 +7920,14 @@ With @option{-O}, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time. +@c Note that in addition to the default_options_table list in opts.c, +@c several optimization flags default to true but control optimization +@c passes that are explicitly disabled at -O0. + @option{-O} turns on the following optimization flags: -@gccoptlist{ --fauto-inc-dec @gol + +@c Please keep the following list alphabetized. +@gccoptlist{-fauto-inc-dec @gol -fbranch-count-reg @gol -fcombine-stack-adjustments @gol -fcompare-elim @gol @@ -7932,11 +7938,11 @@ compilation time. -fdse @gol -fforward-propagate @gol -fguess-branch-probability @gol --fif-conversion2 @gol -fif-conversion @gol +-fif-conversion2 @gol -finline-functions-called-once @gol --fipa-pure-const @gol -fipa-profile @gol +-fipa-pure-const @gol -fipa-reference @gol -fipa-reference-addressable @gol -fmerge-constants @gol @@ -7959,11 +7965,11 @@ compilation time. -ftree-forwprop @gol -ftree-fre @gol -ftree-phiprop @gol +-ftree-pta @gol -ftree-scev-cprop @gol -ftree-sink @gol -ftree-slsr @gol -ftree-sra @gol --ftree-pta @gol -ftree-ter @gol -funit-at-a-time} @@ -7976,10 +7982,12 @@ and the performance of the generated code. @option{-O2} turns on all optimization flags specified by @option{-O}. It also turns on the following optimization flags: -@gccoptlist{-fthread-jumps @gol --falign-functions -falign-jumps @gol --falign-loops -falign-labels @gol + +@c Please keep the following list alphabetized! +@gccoptlist{-falign-functions -falign-jumps @gol +-falign-labels -falign-loops @gol -fcaller-saves @gol +-fcode-hoisting @gol -fcrossjumping @gol -fcse-follow-jumps -fcse-skip-blocks @gol -fdelete-null-pointer-checks @gol @@ -7989,11 +7997,8 @@ also turns on the following optimization flags: -fhoist-adjacent-loads @gol -finline-small-functions @gol -findirect-inlining @gol --fipa-cp @gol --fipa-bit-cp @gol --fipa-vrp @gol --fipa-sra @gol --fipa-icf @gol +-fipa-bit-cp -fipa-cp -fipa-icf @gol +-fipa-ra -fipa-sra -fipa-vrp @gol -fisolate-erroneous-paths-dereference @gol -flra-remat @gol -foptimize-sibling-calls @gol @@ -8003,16 +8008,15 @@ also turns on the following optimization flags: -freorder-blocks-algorithm=stc @gol -freorder-blocks-and-partition -freorder-functions @gol -frerun-cse-after-loop @gol --fsched-interblock -fsched-spec @gol -fschedule-insns -fschedule-insns2 @gol +-fsched-interblock -fsched-spec @gol -fstore-merging @gol -fstrict-aliasing @gol +-fthread-jumps @gol -ftree-builtin-call-dce @gol --ftree-switch-conversion -ftree-tail-merge @gol --fcode-hoisting @gol -ftree-pre @gol --ftree-vrp @gol --fipa-ra} +-ftree-switch-conversion -ftree-tail-merge @gol +-ftree-vrp} Please note the warning under @option{-fgcse} about invoking @option{-O2} on programs that use computed gotos. @@ -8021,21 +8025,23 @@ invoking @option{-O2} on programs that use computed gotos. @opindex O3 Optimize yet more. @option{-O3} turns on all optimizations specified by @option{-O2} and also turns on the following optimization flags: -@gccoptlist{-finline-functions @gol --funswitch-loops @gol --fpredictive-commoning @gol --fgcse-after-reload @gol --ftree-loop-vectorize @gol --ftree-loop-distribution @gol --ftree-loop-distribute-patterns @gol + +@c Please keep the following list alphabetized! +@gccoptlist{-fgcse-after-reload @gol +-finline-functions @gol +-fipa-cp-clone -floop-interchange @gol -floop-unroll-and-jam @gol +-fpeel-loops @gol +-fpredictive-commoning @gol -fsplit-paths @gol --ftree-slp-vectorize @gol --fvect-cost-model @gol +-ftree-loop-distribute-patterns @gol +-ftree-loop-distribution @gol +-ftree-loop-vectorize @gol -ftree-partial-pre @gol --fpeel-loops @gol --fipa-cp-clone} +-ftree-slp-vectorize @gol +-funswitch-loops @gol +-fvect-cost-model} @item -O0 @opindex O0 @@ -8044,13 +8050,16 @@ results. This is the default. @item -Os @opindex Os -Optimize for size. @option{-Os} enables all @option{-O2} optimizations that -do not typically increase code size. It also performs further -optimizations designed to reduce code size. +Optimize for size. @option{-Os} enables all @option{-O2} optimizations +except those that often increase code size: + +@gccoptlist{-falign-functions -falign-jumps @gol +-falign-labels -falign-loops @gol +-fprefetch-loop-arrays -freorder-blocks-algorithm=stc} -@option{-Os} disables the following optimization flags: -@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol --falign-labels -fprefetch-loop-arrays} +It also enables @option{-finline-functions}, causes the compiler to tune for +code size rather than execution speed, and performs further optimizations +designed to reduce code size. @item -Ofast @opindex Ofast @@ -8063,11 +8072,24 @@ specified, and @option{-fno-protect-parens}. @item -Og @opindex Og -Optimize debugging experience. @option{-Og} enables optimizations -that do not interfere with debugging. It should be the optimization +Optimize debugging experience. @option{-Og} should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation -and a good debugging experience. +and a good debugging experience. It is a better choice than @option{-O0} +for producing debuggable code because some compiler passes +that collect debug information are disabled at @option{-O0}. + +Like @option{-O0}, @option{-Og} completely disables a number of +optimization passes so that individual options controlling them have +no effect. Otherwise @option{-Og} enables all @option{-O1} +optimization flags except for those that may interfere with debugging: + +@gccoptlist{-fbranch-count-reg -fdelayed-branch @gol +-fif-conversion -fif-conversion2 @gol +-finline-functions-called-once @gol +-fmove-loop-invariants -fssa-phiopt @gol +-ftree-bit-ccp -ftree-pta -ftree-sra} + @end table If you use multiple @option{-O} options, with or without level numbers, @@ -8194,7 +8216,8 @@ caller even if they are not marked @code{inline}. If a call to a given function is integrated, then the function is not output as assembler code in its own right. -Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}. +Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}, +but not @option{-Og}. @item -fearly-inlining @opindex fearly-inlining @@ -8322,7 +8345,8 @@ IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option doesn't remove the decrement and branch instructions from the generated instruction stream introduced by other optimization passes. -The default is @option{-fbranch-count-reg} at @option{-O1} and higher. +The default is @option{-fbranch-count-reg} at @option{-O1} and higher, +except for @option{-Og}. @item -fno-function-cse @opindex fno-function-cse @@ -8490,14 +8514,16 @@ includes use of conditional moves, min, max, set flags and abs instructions, and some tricks doable by standard arithmetics. The use of conditional execution on chips where it is available is controlled by @option{-fif-conversion2}. -Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. +Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but +not with @option{-Og}. @item -fif-conversion2 @opindex fif-conversion2 Use conditional execution (where available) to transform conditional jumps into branch-less equivalents. -Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. +Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but +not with @option{-Og}. @item -fdeclone-ctor-dtor @opindex fdeclone-ctor-dtor @@ -9072,7 +9098,8 @@ enabled by default at @option{-O} and higher. Perform sparse conditional bit constant propagation on trees and propagate pointer alignment information. This pass only operates on local scalar variables and is enabled by default -at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled. +at @option{-O1} and higher, except for @option{-Og}. +It requires that @option{-ftree-ccp} is enabled. @item -ftree-ccp @opindex ftree-ccp @@ -9090,7 +9117,8 @@ enabled by default at @option{-O} and higher. @item -fssa-phiopt @opindex fssa-phiopt Perform pattern matching on SSA PHI nodes to optimize conditional -code. This pass is enabled by default at @option{-O} and higher. +code. This pass is enabled by default at @option{-O1} and higher, +except for @option{-Og}. @item -ftree-switch-conversion @opindex ftree-switch-conversion @@ -9312,13 +9340,14 @@ that have support for @option{-pthread}. @item -ftree-pta @opindex ftree-pta Perform function-local points-to analysis on trees. This flag is -enabled by default at @option{-O} and higher. +enabled by default at @option{-O1} and higher, except for @option{-Og}. @item -ftree-sra @opindex ftree-sra Perform scalar replacement of aggregates. This pass replaces structure references with scalars to prevent committing structures to memory too -early. This flag is enabled by default at @option{-O} and higher. +early. This flag is enabled by default at @option{-O1} and higher, +except for @option{-Og}. @item -fstore-merging @opindex fstore-merging @@ -10475,7 +10504,7 @@ Enabled with @option{-O3} and/or @option{-fprofile-use}. @item -fmove-loop-invariants @opindex fmove-loop-invariants Enables the loop invariant motion pass in the RTL loop optimizer. Enabled -at level @option{-O1} +at level @option{-O1} and higher, except for @option{-Og}. @item -fsplit-loops @opindex fsplit-loops diff --git a/gcc/opts.c b/gcc/opts.c index e21967ba84d..e513296c34b 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -435,116 +435,127 @@ maybe_default_options (struct gcc_options *opts, lang_mask, handlers, loc, dc); } -/* Table of options enabled by default at different levels. */ +/* Table of options enabled by default at different levels. + Please keep this list sorted by level and alphabetized within + each level; this makes it easier to keep the documentation + in sync. */ static const struct default_options default_options_table[] = { - /* -O1 optimizations. */ - { OPT_LEVELS_1_PLUS, OPT_fdefer_pop, NULL, 1 }, -#if DELAY_SLOTS - { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fdelayed_branch, NULL, 1 }, -#endif - { OPT_LEVELS_1_PLUS, OPT_fguess_branch_probability, NULL, 1 }, + /* -O1 and -Og optimizations. */ + { OPT_LEVELS_1_PLUS, OPT_fcombine_stack_adjustments, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fcompare_elim, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fcprop_registers, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fdefer_pop, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fforward_propagate, NULL, 1 }, - { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fif_conversion, NULL, 1 }, - { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fif_conversion2, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fguess_branch_probability, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fipa_profile, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fipa_pure_const, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fipa_reference, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fipa_reference_addressable, NULL, 1 }, - { OPT_LEVELS_1_PLUS, OPT_fipa_profile, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fmerge_constants, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_freorder_blocks, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fshrink_wrap, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fsplit_wide_types, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_builtin_call_dce, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_ftree_ccp, NULL, 1 }, - { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_ftree_bit_ccp, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_ch, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_ftree_coalesce_vars, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_copy_prop, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_ftree_dce, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_ftree_dominator_opts, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_ftree_dse, NULL, 1 }, - { OPT_LEVELS_1_PLUS, OPT_ftree_ter, NULL, 1 }, - { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_ftree_sra, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_ftree_fre, NULL, 1 }, - { OPT_LEVELS_1_PLUS, OPT_ftree_copy_prop, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_ftree_sink, NULL, 1 }, - { OPT_LEVELS_1_PLUS, OPT_ftree_ch, NULL, 1 }, - { OPT_LEVELS_1_PLUS, OPT_fcombine_stack_adjustments, NULL, 1 }, - { OPT_LEVELS_1_PLUS, OPT_fcompare_elim, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_ftree_slsr, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_ter, NULL, 1 }, + + /* -O1 (and not -Og) optimizations. */ { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fbranch_count_reg, NULL, 1 }, +#if DELAY_SLOTS + { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fdelayed_branch, NULL, 1 }, +#endif + { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fif_conversion, NULL, 1 }, + { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fif_conversion2, NULL, 1 }, + { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_finline_functions_called_once, NULL, 1 }, { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fmove_loop_invariants, NULL, 1 }, - { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_ftree_pta, NULL, 1 }, { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fssa_phiopt, NULL, 1 }, - { OPT_LEVELS_1_PLUS, OPT_ftree_builtin_call_dce, NULL, 1 }, - { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_ftree_bit_ccp, NULL, 1 }, + { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_ftree_sra, NULL, 1 }, + { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_ftree_pta, NULL, 1 }, - /* -O2 optimizations. */ - { OPT_LEVELS_2_PLUS, OPT_finline_small_functions, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_findirect_inlining, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fpartial_inlining, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fthread_jumps, NULL, 1 }, + /* -O2 and -Os optimizations. */ + { OPT_LEVELS_2_PLUS, OPT_fcaller_saves, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fcode_hoisting, NULL, 1 }, { OPT_LEVELS_2_PLUS, OPT_fcrossjumping, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_foptimize_sibling_calls, NULL, 1 }, { OPT_LEVELS_2_PLUS, OPT_fcse_follow_jumps, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fgcse, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fdevirtualize, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fdevirtualize_speculatively, NULL, 1 }, { OPT_LEVELS_2_PLUS, OPT_fexpensive_optimizations, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_frerun_cse_after_loop, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fcaller_saves, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fgcse, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_findirect_inlining, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_finline_small_functions, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fipa_bit_cp, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fipa_cp, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fipa_icf, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fipa_ra, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fipa_sra, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fipa_vrp, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fisolate_erroneous_paths_dereference, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_flra_remat, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_foptimize_sibling_calls, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fpartial_inlining, NULL, 1 }, { OPT_LEVELS_2_PLUS, OPT_fpeephole2, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_frerun_cse_after_loop, NULL, 1 }, #ifdef INSN_SCHEDULING - /* Only run the pre-regalloc scheduling pass if optimizing for speed. */ - { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_fschedule_insns, NULL, 1 }, { OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 }, #endif { OPT_LEVELS_2_PLUS, OPT_fstrict_aliasing, NULL, 1 }, - { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_freorder_blocks_algorithm_, NULL, - REORDER_BLOCKS_ALGORITHM_STC }, - { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fcode_hoisting, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fstore_merging, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fthread_jumps, NULL, 1 }, { OPT_LEVELS_2_PLUS, OPT_ftree_pre, NULL, 1 }, { OPT_LEVELS_2_PLUS, OPT_ftree_switch_conversion, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fipa_cp, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fipa_bit_cp, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fipa_vrp, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fdevirtualize, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fdevirtualize_speculatively, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fipa_sra, NULL, 1 }, - { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_falign_loops, NULL, 1 }, - { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_falign_jumps, NULL, 1 }, - { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_falign_labels, NULL, 1 }, - { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_falign_functions, NULL, 1 }, { OPT_LEVELS_2_PLUS, OPT_ftree_tail_merge, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 }, { OPT_LEVELS_2_PLUS, OPT_fvect_cost_model_, NULL, VECT_COST_MODEL_CHEAP }, + + /* -O2 and -Os optimizations. */ + { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_falign_functions, NULL, 1 }, + { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_falign_jumps, NULL, 1 }, + { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_falign_labels, NULL, 1 }, + { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_falign_loops, NULL, 1 }, { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_foptimize_strlen, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fipa_icf, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fisolate_erroneous_paths_dereference, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fipa_ra, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_flra_remat, NULL, 1 }, - { OPT_LEVELS_2_PLUS, OPT_fstore_merging, NULL, 1 }, + { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_freorder_blocks_algorithm_, NULL, + REORDER_BLOCKS_ALGORITHM_STC }, +#ifdef INSN_SCHEDULING + /* Only run the pre-regalloc scheduling pass if optimizing for speed. */ + { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_fschedule_insns, NULL, 1 }, +#endif - /* -O3 optimizations. */ - { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 }, - { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribution, NULL, 1 }, - { OPT_LEVELS_3_PLUS, OPT_floop_interchange, NULL, 1 }, - { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 }, - { OPT_LEVELS_3_PLUS, OPT_fsplit_paths, NULL, 1 }, + /* -O3 and -Os optimizations. */ /* Inlining of functions reducing size is a good idea with -Os regardless of them being declared inline. */ { OPT_LEVELS_3_PLUS_AND_SIZE, OPT_finline_functions, NULL, 1 }, - { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_finline_functions_called_once, NULL, 1 }, - { OPT_LEVELS_3_PLUS, OPT_fsplit_loops, NULL, 1 }, - { OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 }, - { OPT_LEVELS_3_PLUS, OPT_floop_unroll_and_jam, NULL, 1 }, + + /* -O3 optimizations. */ { OPT_LEVELS_3_PLUS, OPT_fgcse_after_reload, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_floop_interchange, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_floop_unroll_and_jam, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_fpeel_loops, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_fsplit_loops, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_fsplit_paths, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribution, NULL, 1 }, { OPT_LEVELS_3_PLUS, OPT_ftree_loop_vectorize, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_ftree_partial_pre, NULL, 1 }, { OPT_LEVELS_3_PLUS, OPT_ftree_slp_vectorize, NULL, 1 }, + { OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 }, { OPT_LEVELS_3_PLUS, OPT_fvect_cost_model_, NULL, VECT_COST_MODEL_DYNAMIC }, - { OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 }, - { OPT_LEVELS_3_PLUS, OPT_ftree_partial_pre, NULL, 1 }, - { OPT_LEVELS_3_PLUS, OPT_fpeel_loops, NULL, 1 }, /* -Ofast adds optimizations to -O3. */ { OPT_LEVELS_FAST, OPT_ffast_math, NULL, 1 },