This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Differences between -O2 and -O3
- From: bernd Kopf <bayerntoni at hotmail dot de>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Mon, 16 Aug 2010 21:45:03 +0200
- Subject: Differences between -O2 and -O3
Hello,
Is there a way to know what are exactly the differences between -O2 and -O3?
According to the manual level 3 is level 2 plus -finline-functions -funswitch-loops -fpredictive-commoning -fgcse-after-reload -ftree-vectorize
By comparing the outputs of gcc -O2 -c -Q and gcc -O3 -c -Q I found out that -O3 also adds -fipa-cp-clone
By adding these options to -O2 I don't get the same exe than -O3. Same thing when I add their negative forms to -O3, I don't get the same exe than -O2
-O2 687 kb
-O3 937 kb
-O2 -finline-functions -funswitch-loops -fpredictive-commoning -fgcse-after-reload -ftree-vectorize -fipa-cp-clone 733 kb
-O3 -fno-inline-functions -fno-unswitch-loops -fno-predictive-commoning -fno-gcse-after-reload -fno-tree-vectorize -fno-ipa-cp-clone 818 kb
I checked opts.c but it didn't enlight me. I also try gcc --help=params, but it only reports the list, not values of the params at -O2 or -O3
Does -O3 change some params? And how to know which ones?
Or does gcc do some internal optimizations that can't be control by flags?