This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: powercp-linux cross GCC 4.2 vs GCC 4.0.0: -Os code size regression?
- From: Andrew Haley <aph at redhat dot com>
- To: Sergei Poselenov <sposelenov at emcraft dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 16 Jan 2008 12:34:59 +0000
- Subject: Re: powercp-linux cross GCC 4.2 vs GCC 4.0.0: -Os code size regression?
- References: <478DE61D.3060709@emcraft.com>
Sergei Poselenov writes:
> Hello all,
>
> I'm using the ppc-linux gcc-4.2.2 compiler and noted the code
> size have increased significantly (about 40%!), comparing with
> old 4.0.0 when using the -Os option. Same code, same compile-
> and configuration-time options. Binutils are differ
> (2.16.1 vs 2.17.50), though.
>
> I've looked at the CSiBE testing results for ppc-elf with -Os,
> comparing gcc_4_0_0 with mainline and found that the mainline
> actually optimizes better, at least for the CSiBE test environment.
> After some analysis I've came to the following results:
> Number of packages in the CSiBE test environment: 863
> N of packages where mainline GCC optimizes better: 290
> N of packages where mainline GCC optimizes worse: 436
>
> And the regression in code size is up to 40%, like in my case.
40% seems severe, but it may be an outlier. What is the average
increase in code size, including the packages where it got better?
> What I'm missing here? Apparently, just "-Os" is not enough to
> get the best size-optimized code?
Not necessarily. -Os is mostly [*] the same as -O2 but with
optimizations that might reasonably be expected to cause code size
increase disabled. You might find some better combination of options
for your code base.
Andrew.
[*] Full disclosure: There are a few optimizations, such as code
hoisting, that are specially used with -Os. There are also some
passes with special tuning for -Os.
--
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903