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

"Zack Weinberg" <> writes:

> On Sun, May 27, 2001 at 11:46:51PM -0400, wrote:
> > I do not understand the philosophy behind only enabling strict aliasing
> > at -O3. Generally we often find -O3 to be a disadvantage because of the
> > excessive inlining which can cause icache penalties. But strict aliasing
> > seems like something that should come along with -O2.
> Reality injection: -fstrict-aliasing is enabled at -O2 in all
> snapshots since 2.96, and will be in 3.0.  It was turned off on the
> 2.95 branch to give people more time to fix their code.  It is our
> understanding that most free software projects have either fixed their
> code or wired in a -fno-strict-aliasing where appropriate.
> -O3 turns on inlining of all functions and register renaming.  I
> believe the intent is to move -frename-registers to -O2 once it no
> longer causes such severe problems with debugging (i.e. once DWARF2
> with location lists is the default on most common platforms).
> We haven't really had a sensible policy about what -O levels mean,

Actually, we do.  They're fully documented in the Info documentation:

     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.
     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.
     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.

     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.

> except that -O2 should be a reasonable default choice (which it isn't
> always; -O or -Os have been reported to be better under a rather broad
> set of conditions).

- Geoffrey Keating <>

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