You can use the flags Q --help=target,optimizer
in combination with any optimizer flags ( e.g. -O2 or -O1) to view the applied flags.
This is documented here
If you are using bash, you can use the below oneliner to view the difference between e.g. -O0 and -O1)
$ diff -u <(gcc -O0 -Q --help=optimizer ) <(gcc -Q --help=optimizer -O1)
--- /dev/fd/63 2016-06-20 08:20:36.957943807 +0200
+++ /dev/fd/62 2016-06-20 08:20:36.958943794 +0200
@@ -11,22 +11,22 @@
-fassociative-math [disabled]
-fasynchronous-unwind-tables [enabled]
-fauto-inc-dec [enabled]
- -fbranch-count-reg [disabled]
+ -fbranch-count-reg [enabled]
-fbranch-probabilities [disabled]
-fbranch-target-load-optimize [disabled]
-fbranch-target-load-optimize2 [disabled]
-fbtr-bb-exclusive [disabled]
-fcaller-saves [disabled]
- -fcombine-stack-adjustments [disabled]
- -fcompare-elim [disabled]
+ -fcombine-stack-adjustments [enabled]
+ -fcompare-elim [enabled]
-fconserve-stack [disabled]
- -fcprop-registers [disabled]
+ -fcprop-registers [enabled]
-fcrossjumping [disabled]
-fcse-follow-jumps [disabled]
-fcx-fortran-rules [disabled]
-fcx-limited-range [disabled]
-fdce [enabled]
- -fdefer-pop [disabled]
+ -fdefer-pop [enabled]
-fdelayed-branch [disabled]
-fdelete-dead-exceptions [disabled]
-fdelete-null-pointer-checks [enabled]
@@ -38,7 +38,7 @@
-fexpensive-optimizations [disabled]
-ffinite-math-only [disabled]
-ffloat-store [disabled]
- -fforward-propagate [disabled]
+ -fforward-propagate [enabled]
-ffp-contract= fast
-ffunction-cse [enabled]
-fgcse [disabled]
@@ -48,27 +48,27 @@
-fgcse-sm [disabled]
-fgraphite [disabled]
-fgraphite-identity [disabled]
- -fguess-branch-probability [disabled]
+ -fguess-branch-probability [enabled]
-fhandle-exceptions
-fhoist-adjacent-loads [disabled]
- -fif-conversion [disabled]
- -fif-conversion2 [disabled]
+ -fif-conversion [enabled]
+ -fif-conversion2 [enabled]
-findirect-inlining [disabled]
-finline [enabled]
-finline-atomics [enabled]
-finline-functions [disabled]
- -finline-functions-called-once [disabled]
+ -finline-functions-called-once [enabled]
-finline-small-functions [disabled]
-fipa-cp [disabled]
-fipa-cp-alignment [disabled]
-fipa-cp-clone [disabled]
-fipa-icf [disabled]
-fipa-icf-functions [disabled]
- -fipa-profile [disabled]
+ -fipa-profile [enabled]
-fipa-pta [disabled]
- -fipa-pure-const [disabled]
+ -fipa-pure-const [enabled]
-fipa-ra [disabled]
- -fipa-reference [disabled]
+ -fipa-reference [enabled]
-fipa-sra [disabled]
-fira-algorithm= CB
-fira-hoist-pressure [enabled]
@@ -92,7 +92,7 @@
-fmath-errno [enabled]
-fmodulo-sched [disabled]
-fmodulo-sched-allow-regmoves [disabled]
- -fmove-loop-invariants [disabled]
+ -fmove-loop-invariants [enabled]
-fnon-call-exceptions [disabled]
-fnothrow-opt [disabled]
-fomit-frame-pointer [disabled]
@@ -145,14 +145,14 @@
-fshort-double [disabled]
-fshort-enums [enabled]
-fshort-wchar [disabled]
- -fshrink-wrap [disabled]
+ -fshrink-wrap [enabled]
-fsignaling-nans [disabled]
-fsigned-zeros [enabled]
-fsimd-cost-model= unlimited
-fsingle-precision-constant [disabled]
-fsplit-ivs-in-unroller [enabled]
- -fsplit-wide-types [disabled]
- -fssa-phiopt [disabled]
+ -fsplit-wide-types [enabled]
+ -fssa-phiopt [enabled]
-fstack-reuse= all
-fstdarg-opt [enabled]
-fstrict-aliasing [disabled]
@@ -164,20 +164,20 @@
-ftracer [disabled]
-ftrapping-math [enabled]
-ftrapv [disabled]
- -ftree-bit-ccp [disabled]
+ -ftree-bit-ccp [enabled]
-ftree-builtin-call-dce [disabled]
- -ftree-ccp [disabled]
- -ftree-ch [disabled]
+ -ftree-ccp [enabled]
+ -ftree-ch [enabled]
-ftree-coalesce-inlined-vars [disabled]
-ftree-coalesce-vars [enabled]
- -ftree-copy-prop [disabled]
- -ftree-copyrename [disabled]
+ -ftree-copy-prop [enabled]
+ -ftree-copyrename [enabled]
-ftree-cselim [enabled]
- -ftree-dce [disabled]
- -ftree-dominator-opts [disabled]
- -ftree-dse [disabled]
+ -ftree-dce [enabled]
+ -ftree-dominator-opts [enabled]
+ -ftree-dse [enabled]
-ftree-forwprop [enabled]
- -ftree-fre [disabled]
+ -ftree-fre [enabled]
-ftree-loop-distribute-patterns [disabled]
-ftree-loop-distribution [disabled]
-ftree-loop-if-convert [enabled]
@@ -191,16 +191,16 @@
-ftree-partial-pre [disabled]
-ftree-phiprop [enabled]
-ftree-pre [disabled]
- -ftree-pta [disabled]
+ -ftree-pta [enabled]
-ftree-reassoc [enabled]
-ftree-scev-cprop [enabled]
- -ftree-sink [disabled]
+ -ftree-sink [enabled]
-ftree-slp-vectorize [disabled]
- -ftree-slsr [disabled]
- -ftree-sra [disabled]
+ -ftree-slsr [enabled]
+ -ftree-sra [enabled]
-ftree-switch-conversion [disabled]
-ftree-tail-merge [disabled]
- -ftree-ter [disabled]
+ -ftree-ter [enabled]
-ftree-vectorize [disabled]
-ftree-vrp [disabled]
-funroll-all-loops [disabled]
-O1 -fno-*
, maybe some-fdisable-*
, but I still don't believe that will help you much. – Benedictus-O
-related behavior needs to be understood somehow, so I guess I'll have to patch gcc itself to get some extra information. – Firooc