This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Inline functiion in GCC
Paul Brook wrote:
On Friday 06 August 2004 22:20, James E Wilson wrote:
Paul Brook wrote:
Like most compilers, gcc generates very poor code if you don't turn
optimization on.
But don't most compilers emit optimized code by default nowadays? We
would eliminate some of the questions we get if we defaulted to -O1
instead of -O0.
There is no strict definition of what optimized means, and
consequently unoptimized means different things to different
compilers. It is definitely the case that -O0 gcc code is
spectacularly bad. A hand built code generator with no
concious optimization will almost certainly do much better,
so indeed gcc fairs poorly in comparison with other compilers
in unoptimized mode (both in space and time).
This frequently causes trouble with our users (our = AdaCore)
who don't want to turn on optimization because of any or all of
the following:
a) they have been burned by optimizers in the past
b) they figure it's fine to benchmark compilers on a "level
playing ground" of optimization turned off for both
compilers.
c) they are writing safety critical code and dislike
optimziation because of traceability issues.
d) they figure they can only debug unoptimized code
e) they are benchmarking naively and use the default
options by default.
It wouldn't hurt if gcc generated a bit better code in -O0,
it is really painful for example on the x86 to see all the
useless register moves that are generated.