This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Should -fcross-jumping be part of -O1?
- From: Robert Dewar <dewar at gnat dot com>
- To: David Carlton <carlton at kealia dot com>
- Cc: Zack Weinberg <zack at codesourcery dot com>,gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Tue, 02 Dec 2003 13:54:01 -0500
- Subject: Re: Should -fcross-jumping be part of -O1?
- References: <3FC0DCD0.9000106@coyotegulch.com> <20031123162248.GA336@atrey.karlin.mff.cuni.cz> <3FC0EC7E.7070800@coyotegulch.com> <20031123173321.GO15575@kam.mff.cuni.cz> <3FC0F7A6.4010103@coyotegulch.com> <20031123181903.GW15575@kam.mff.cuni.cz> <3FC11F13.2090708@coyotegulch.com> <877k1fmxr4.fsf@egil.codesourcery.com> <yf2znebtaxt.fsf@hawaii.kealia.com>
David Carlton wrote:
This is obviously a very special case, but dead code elimination
sometimes makes it difficult to write tests for GDB's test suite. And
even when working on real programs I occasionally insert dead code as
a place where I can set breakpoints. So, personally, I'd prefer that
-O0 be pretty stupid. (Though I don't mind if it's not the default.)
I don't see that convenience of the GDB test suite should be a
determining factor.
One real problem with gcc is that -O0 is too painfully stupid. It
generates piles of junk code.
This has three downsides:
1. In some environments, it is a policy not to use any optimization
switches (typically this is because of bad previous experience with
various optimizing compilers). This means that gcc gets compared to
other compilers in "non-optimizing" mode and in such comparisons, gcc
does poorly. Yes, this is unfair, but life is unfair, and you still
end up loosing a potential gcc user.
2. Simple minded compiler benchmarks are often done with default
settings, and the performance of gcc in such settings is often
poor. This is related to 1, and is the same issue technically but
is a little different from a documentation and marketing point of
view.
3. With the current state of technology, you really can't do very much
with GDB at other than -O0. Yes, hackers who know what is going on can
manage to debug at -O1 or even -O2, and do all the time -- I usually am
running gdb on optimized code and I learn what to trust and not to
trust. But users who actually expect the debugger to work, and who
operate at a high semantic level can find the behavior quite
unacceptable at -O1 and -O2. So this drives the use of unoptimized
code for debugging, but this can lead to painfully big (hundreds of
megabytes) images which are unwieldy.
We have talked before of something like -Od, which would say do all the
optimization you can without compromising debuggability. This could very
well be the default, then -O0 could *really* deoptimize including not
deleting dead code, and any other horrible things we can think of :-)