This is the mail archive of the 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]

Re: criteria.html open issues

On Tue, May 29, 2001 at 01:18:20AM -0700, Geoff Keating wrote:
> "Zack Weinberg" <> writes:
> > 
> > We haven't really had a sensible policy about what -O levels mean,
> Actually, we do.  They're fully documented in the Info documentation:
> `-O'
> `-O1'
>      Optimize.  Optimizing compilation takes somewhat more time, and a
>      lot more memory for a large function.
>      Without `-O', the compiler's goal is to reduce the cost of
>      compilation and to make debugging produce the expected results.
> ...
> `-O2'
>      Optimize even more.  GCC performs nearly all supported
>      optimizations that do not involve a space-speed tradeoff.  The
>      compiler does not perform loop unrolling or function inlining when
>      you specify `-O2'.  As compared to `-O', this option increases
>      both compilation time and the performance of the generated code.

Okay, so this leads me to believe that in terms of performance of
generated code, -O0 < -O1 < -O2 for most code.  How does this fit with
the reports that -O1 is about the same, or better than, -O2 in terms
of generated code performance, over a broad range of sources?  Yes,
optimizations can't be counted on to improve performance always, but
we could put some effort into tuning the gross-level heuristics for
what to run at each -O level.

> `-O3'
>      Optimize yet more.  `-O3' turns on all optimizations specified by
>      `-O2' and also turns on the `inline-functions' option.
> Actually, this is slightly out-of-date.  -O3 switches on the
> optimisations that will trade space for speed.

-frename-registers trades space for speed?  And why doesn't it turn on
-funroll-loops or -funroll-all-loops, then?

Why is -O3 -finline-functions in c-torture.exp as a separate
possibility when -O3 already turns on -finline-functions?

> ...
> `-Os'
>      Optimize for size.  `-Os' enables all `-O2' optimizations that do
>      not typically increase code size.  It also performs further
>      optimizations designed to reduce code size.

How does this fit with the assertion, above, that -O2 does not trade
size for speed?

zw               "Shouldn't a witch be eccentric?"
                 "I hope not. I've never been good at cackling."
                 	-- Reinder Dijkhuis, _Rogues of Clwyd-Rhan_

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