Flags turned on by GCC standard optimizations

staticx mohamedboussaa3@gmail.com
Fri Nov 20 17:47:00 GMT 2015


Here, I compile an input program with -O2 optimization level (with gcc 4.8.4)
and measure the execution time:

    gcc -O2 -c test.c -o obj.o
    TIMEFORMAT='%3R' &&  time(./obj.o)
    execution time = 1.825

and when I replace -O2 flag with the list of options that are turned on as
defined in GCC manuel in the level -O2
https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gcc/Optimize-Options.html#Optimize-Options
like that:

    gcc -fauto-inc-dec -fcompare-elim -fcprop-registers -fdce -fdefer-pop
-fdse -fguess-branch-probability -fif-conversion2 -fif-conversion
-fipa-pure-const -fipa-profile -fipa-reference -fmerge-constants
-fsplit-wide-types -ftree-bit-ccp  -ftree-builtin-call-dce -ftree-ccp
-ftree-ch -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse
-ftree-forwprop -ftree-fre -ftree-phiprop -ftree-slsr -ftree-sra -ftree-pta
-ftree-ter -funit-at-a-time -fthread-jumps -falign-functions  -falign-jumps
-falign-loops  -falign-labels -fcaller-saves -fcrossjumping
-fcse-follow-jumps  -fcse-skip-blocks -fdelete-null-pointer-checks
-fdevirtualize -fexpensive-optimizations -fgcse  -fgcse-lm 
-fhoist-adjacent-loads -finline-small-functions -findirect-inlining
-fipa-sra -foptimize-sibling-calls -fpartial-inlining -fpeephole2 -fregmove 
-freorder-blocks  -freorder-functions -frerun-cse-after-loop
-fsched-interblock  -fsched-spec -fschedule-insns  -fschedule-insns2
-fstrict-aliasing -fstrict-overflow -ftree-switch-conversion
-ftree-tail-merge -ftree-pre -ftree-vrp -c test.c -o obj.o
        TIMEFORMAT='%3R' &&  time(./obj.o)
    execution time = 2.652

My question is why the execution time is different even so, I applied the
same optimizations ? 



--
View this message in context: http://gcc.1065356.n5.nabble.com/Flags-turned-on-by-GCC-standard-optimizations-tp1207835.html
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list