This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Gcc optimization flags


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]