Boost logo

Boost-Build :

Subject: Re: [Boost-build] Choice of optimization flags for GCC
From: David Abrahams (dave_at_[hidden])
Date: 2008-09-09 11:45:40


on Mon Sep 08 2008, Vladimir Prus <vladimir-AT-codesourcery.com> wrote:

> On Monday 08 September 2008 22:51:11 David Abrahams wrote:
>>
>> According to http://www.gentoo.org/doc/en/gcc-optimization.xml, we are
>> using suboptimal optimization settings when building on GCC-4.x (-O3;
>> they say it should be -O2). I seem to recall hearing from someone (who
>> ought to know) that -O3 was actually strictly experimental and not even
>> guaranteed to produce correct code. But I may be misremembering and I
>> am unable to corroborate any of this. Anyone?
>
> FWIW, CodeSourcery's support recommends -O2, because -O3 was found not to
> be uniformly better than -O2. But we're on thin ice here -- benchmarks
> results are valid for a specific compiler version, with specific vendor
> patches and configuration so that recommendation may be right for our
> specific release, but not necessary right for every random gcc in the wild.
>
> If a user really care for performance, he can experiement with
> specific flags, adding them via cxxflags feature. Say, gcc benchmarks on
>
> http://gcc.gnu.org/benchmarks/
>
> use contrived flags, like, for example:
>
> -O3 -funroll-loops -fpeel-loops -ffast-math

Yes, but then we have another problem: the gcc documentation says that
you should only use one -Ox option on the command-line, and we have no
way to avoid producing command lines containing one of the values -O0
-O3 or -Os.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk