public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100473] New: O2 vs optimization flags
@ 2021-05-07 14:06 stanislav.simek at siemens dot com
2021-05-07 14:42 ` [Bug c/100473] " schwab@linux-m68k.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: stanislav.simek at siemens dot com @ 2021-05-07 14:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100473
Bug ID: 100473
Summary: O2 vs optimization flags
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: stanislav.simek at siemens dot com
Target Milestone: ---
Hi all,
May I ask you, why the object file created with option -O2 is different than
with all flags (for O1 + O2) mentioned here:
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
Eq.
Why object generated with -O2 is different (in assembly)
than object generated with:
=== O1 part===
-fauto-inc-dec
-fbranch-count-reg
-fcombine-stack-adjustments
-fcompare-elim
-fcprop-registers
-fdce
-fdefer-pop
-fdelayed-branch
-fdse
-fforward-propagate
-fguess-branch-probability
-fif-conversion
-fif-conversion2
-finline-functions-called-once
-fipa-modref
-fipa-profile
-fipa-pure-const
-fipa-reference
-fipa-reference-addressable
-fmerge-constants
-fmove-loop-invariants
-fomit-frame-pointer
-freorder-blocks
-fshrink-wrap
-fshrink-wrap-separate
-fsplit-wide-types
-fssa-backprop
-fssa-phiopt
-ftree-bit-ccp
-ftree-ccp
-ftree-ch
-ftree-coalesce-vars
-ftree-copy-prop
-ftree-dce
-ftree-dominator-opts
-ftree-dse
-ftree-forwprop
-ftree-fre
-ftree-phiprop
-ftree-pta
-ftree-scev-cprop
-ftree-sink
-ftree-slsr
-ftree-sra
-ftree-ter
-funit-at-a-time
=== O2 part ===
-falign-functions -falign-jumps
-falign-labels -falign-loops
-fcaller-saves
-fcode-hoisting
-fcrossjumping
-fcse-follow-jumps -fcse-skip-blocks
-fdelete-null-pointer-checks
-fdevirtualize -fdevirtualize-speculatively
-fexpensive-optimizations
-ffinite-loops
-fgcse -fgcse-lm
-fhoist-adjacent-loads
-finline-functions
-finline-small-functions
-findirect-inlining
-fipa-bit-cp -fipa-cp -fipa-icf
-fipa-ra -fipa-sra -fipa-vrp
-fisolate-erroneous-paths-dereference
-flra-remat
-foptimize-sibling-calls
-foptimize-strlen
-fpartial-inlining
-fpeephole2
-freorder-blocks-algorithm=stc
-freorder-blocks-and-partition -freorder-functions
-frerun-cse-after-loop
-fschedule-insns -fschedule-insns2
-fsched-interblock -fsched-spec
-fstore-merging
-fstrict-aliasing
-fthread-jumps
-ftree-builtin-call-dce
-ftree-pre
-ftree-switch-conversion -ftree-tail-merge
-ftree-vrp
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/100473] O2 vs optimization flags
2021-05-07 14:06 [Bug c/100473] New: O2 vs optimization flags stanislav.simek at siemens dot com
@ 2021-05-07 14:42 ` schwab@linux-m68k.org
2021-05-07 14:58 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: schwab@linux-m68k.org @ 2021-05-07 14:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100473
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
$ git grep 'optimize >= 2'
gcc/ChangeLog-2008: 100 for optimize >= 2.
gcc/ChangeLog-2010: only conditionally on optimize >= 2.
gcc/ada/gcc-interface/trans.c: && optimize >= 2
gcc/c-family/c-opts.c: optimize >= 2 && cxx_dialect >= cxx11);
gcc/config/aarch64/aarch64-cc-fusion.cc: virtual bool gate (function *) {
return TARGET_SVE && optimize >= 2; }
gcc/config/aarch64/cortex-a57-fma-steering.c: && optimize >= 2;
gcc/config/aarch64/falkor-tag-collision-avoidance.c: && optimize >=
2);
gcc/config/arm/arm.c: else if (optimize >= 2)
gcc/config/arm/arm.h: ((optimize >= 2) \
gcc/config/msp430/msp430.c: bool speed = (!optimize_size && optimize >= 2);
gcc/config/msp430/msp430.c: && (optimize >= 2 && !optimize_size))))
gcc/config/msp430/msp430.c: && (optimize >= 2 && !optimize_size)
gcc/config/msp430/msp430.h:#define NO_FUNCTION_CSE (optimize >= 2 &&
!optimize_size)
gcc/expr.c: && optimize >= 2
gcc/expr.c: if (SCALAR_INT_MODE_P (mode) && optimize >= 2)
gcc/opts.c: opt2 = (opts->x_optimize >= 2);
gcc/tree-ssa-dce.c: return perform_tree_ssa_dce (/*aggressive=*/optimize >=
2);
gcc/tree-ssa-loop-ivcanon.c: virtual bool gate (function *) { return optimize
>= 2; }
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/100473] O2 vs optimization flags
2021-05-07 14:06 [Bug c/100473] New: O2 vs optimization flags stanislav.simek at siemens dot com
2021-05-07 14:42 ` [Bug c/100473] " schwab@linux-m68k.org
@ 2021-05-07 14:58 ` jakub at gcc dot gnu.org
2021-05-07 16:00 ` [Bug middle-end/100473] " pinskia at gcc dot gnu.org
2021-05-10 7:28 ` stanislav.simek at siemens dot com
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-07 14:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100473
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
CC| |jakub at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And
git grep 'optimize > 1'
gcc/config/arc/arc.c: return (optimize > 1 && !TARGET_NO_COND_EXEC);
gcc/config/arc/arc.c: if (optimize > 1 && !TARGET_NO_COND_EXEC)
gcc/config/i386/i386-expand.c: && optimize > 1)
gcc/config/i386/i386-features.c: && TARGET_STV && TARGET_SSE2 &&
optimize > 1);
gcc/config/mcore/mcore.c: if (optimize > 1 && blk_size > 2)
gcc/config/rl78/rl78.c: if (optimize > 1)
gcc/cse.c: else if (tem == 1 || optimize > 1)
gcc/dce.c: return optimize > 1 && flag_dce && dbg_cnt (dce_ud);
gcc/df-core.c: if (optimize > 1)
gcc/early-remat.c: return optimize > 1 && NUM_POLY_INT_COEFFS > 1;
gcc/ira.c: if (optimize > 1)
gcc/ira.c: if (optimize > 1)
gcc/tree-eh.c: if (optimize > 1)
gcc/tree-ssa-sccvn.c: return flag_tree_fre != 0 && (may_iterate ||
optimize > 1);
gcc/tree-ssa-sccvn.c: bool iterate_p = may_iterate && (optimize > 1);
git grep 'optimize <= 1'
gcc/df-problems.c: df_live->optional_p = (optimize <= 1);
git grep 'optimize < 2'
gcc/builtins.c: if (optimize < 2 || optimize_insn_for_size_p ())
gcc/cfgexpand.c: if (toplevel && optimize < 2)
gcc/config/arc/arc.c: if (optimize < 2 || TARGET_NO_COND_EXEC)
gcc/config/pa/pa.c: if (optimize < 2)
gcc/dse.c: if (optimize < 2)
gcc/expr.c: if (optimize < 2)
gcc/loop-invariant.c: if (optimize < 2)
gcc/tree-ssa-loop-im.c: if (optimize < 2)
I think we've never claimed that -O2 stands for -O1 + specific options,
similarly to how -O1 certainly is not -O0 + lots of options (even much more
different, because if (optimize) is very common and is used in gating tests of
whole pass sets.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/100473] O2 vs optimization flags
2021-05-07 14:06 [Bug c/100473] New: O2 vs optimization flags stanislav.simek at siemens dot com
2021-05-07 14:42 ` [Bug c/100473] " schwab@linux-m68k.org
2021-05-07 14:58 ` jakub at gcc dot gnu.org
@ 2021-05-07 16:00 ` pinskia at gcc dot gnu.org
2021-05-10 7:28 ` stanislav.simek at siemens dot com
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-05-07 16:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100473
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |middle-end
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> I think we've never claimed that -O2 stands for -O1 + specific options,
> similarly to how -O1 certainly is not -O0 + lots of options (even much more
> different, because if (optimize) is very common and is used in gating tests
> of whole pass sets.
From
https://gcc.gnu.org/onlinedocs/gcc-11.1.0/gcc/Optimize-Options.html#Optimize-Options
:
Not all optimizations are controlled directly by a flag. Only optimizations
that have a flag are listed in this section.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/100473] O2 vs optimization flags
2021-05-07 14:06 [Bug c/100473] New: O2 vs optimization flags stanislav.simek at siemens dot com
` (2 preceding siblings ...)
2021-05-07 16:00 ` [Bug middle-end/100473] " pinskia at gcc dot gnu.org
@ 2021-05-10 7:28 ` stanislav.simek at siemens dot com
3 siblings, 0 replies; 5+ messages in thread
From: stanislav.simek at siemens dot com @ 2021-05-10 7:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100473
--- Comment #4 from Stanislav Šimek <stanislav.simek at siemens dot com> ---
Okay, thank you a lot for explanation.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-10 7:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 14:06 [Bug c/100473] New: O2 vs optimization flags stanislav.simek at siemens dot com
2021-05-07 14:42 ` [Bug c/100473] " schwab@linux-m68k.org
2021-05-07 14:58 ` jakub at gcc dot gnu.org
2021-05-07 16:00 ` [Bug middle-end/100473] " pinskia at gcc dot gnu.org
2021-05-10 7:28 ` stanislav.simek at siemens dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).