I tried to optimize C code with gcc. If I use -O1 option will have a better running time but if i use equivalent
-fauto-inc-dec
-fcompare-elim
-fcprop-registers
-fdce
-fdefer-pop
-fdelayed-branch
-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
its like I didn't use any options flag. GCC version is 4.8.2. Please, who can explain me why? I just found that order of these flags matter but I didn't found which order is in -O1.
gettimeofday(&tv1, NULL); func(); gettimeofday(&tv2, NULL); printf("%f msec\n", (double)(tv2.tv_usec - tv1.tv_usec) / 1000 + (double)(tv2.tv_sec - tv1.tv_sec) * 1000);same imput every time. I'm not allowed to use -O1 optimization flag but any other flag