This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Gcc optimization flags
- From: Erik Trulsson <ertr1013 at student dot uu dot se>
- To: Long Fei <lfei at ecn dot purdue dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 6 Aug 2003 04:50:28 +0200
- Subject: Re: Gcc optimization flags
- References: <000601c35bc2$ccefda80$2c7b2e80@ee271dpc5>
On Tue, Aug 05, 2003 at 09:31:10PM -0500, Long Fei wrote:
>
> It seems that without turning on the -O flag, other optimization flags
> won't have any effect ?
I believe that is correct.
> Did anybody have any experience in using the flags separately rather
> than -Ox ?
>
> If I want to run a single optimization, for instance, unroll-loops, how
> can I do without -O (and thus bringing in -fdefer-pop,
> -fmerge-constants, -fthread-jumps, -floop-optimize, -fcrossjumping,
> -fif-conversion, -fif-conversion2, -fdelayed-branch,
> -fguess-branch-probability, -fcprop-registers) which may "pollute" the
> result ?
Use "-O -fno-defer-pop -fno-merge-constants" etc. I.e. use -O and then
turn off all the unwanted optimizations.
Clumsy, but I believe that is the only way to get the effect you want.
>
> I had a simple test. The results of the following two compilations are
> different:
> gcc -O foo.c
> gcc -fdefer-pop -fmerge-constants -fthread-jumps -floop-optimize
> -fcrossjumping -fif-conversion -fif-conversion2 -fdelayed-branch
> -fguess-branch-probability -fcprop-registers foo.c
>
> While -O should be equivalent to "-fdefer-pop -fmerge-constants
> -fthread-jumps -floop-optimize -fcrossjumping -fif-conversion
> -fif-conversion2 -fdelayed-branch -fguess-branch-probability
> -fcprop-registers".
>
> Can anybody (expert/insider) give a detailed explanation ?
As I understand it one needs to use one of the -O flags to turn on
optimization. Without it no optimization is actually done.
Once optimization is turned on you can use the various -ffoo flags to
control what optimizations are performed.
--
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se