This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: criteria.html open issues
- To: "Zack Weinberg" <zackw at stanford dot edu>
- Subject: Re: criteria.html open issues
- From: Geoff Keating <geoffk at geoffk dot org>
- Date: 29 May 2001 01:18:20 -0700
- CC: gcc at gcc dot gnu dot org
- References: <20010527223729.D28699@stanford.edu>
"Zack Weinberg" <zackw@stanford.edu> writes:
> On Sun, May 27, 2001 at 11:46:51PM -0400, dewar@gnat.com 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:
`-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.
...
`-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.
...
`-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.
> 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 <geoffk@geoffk.org>