Need some opinions

craig@jcb-sc.com craig@jcb-sc.com
Sat Mar 6 14:29:00 GMT 1999


>I would prefer to do this.  I think we should be doing just a tad
>more work in "no optimization" mode, primarily in terms of getting
>rid of unreachable code.
>
>Drepper has a one-line <tgmath.h> test case that expands to an
>unconditional branch around 46K of code.  With optimization, the
>function is 3 instructions long.

My feeling is, if the optimization is likely to save as much (or more)
overall compile/link time as, say, twice as much as it costs, it's
probably worth turning on for -O0.

E.g. folding constants, done for -O0, costs time up front, but saves
all sorts of code-generation time down the line -- in later RTL
phases, in generated the .s file, in running the assembler, the
linker, and the loader, etc.

This does mean we should avoid enabling any optimization for -O0
that could ever require significantly-greater-than-linear-to-source-
code time to run.  Or something like that.  I'm not saying -O0 should
always compile faster than -O1, -O2, or similar, but it should not
require exponential time to compile due to optimizations.

I would think we could fit eliminating most "obvious" dead code,
and other such jump optimizations, into the above requirements,
if we were to adopt them for -O0.

        tq vm, (burley)


More information about the Gcc mailing list