[LLVMdev] Compiler Driver Decisions

Reid Spencer reid at x10sys.com
Wed Aug 4 12:16:12 PDT 2004


On Wed, 2004-08-04 at 10:08, Chris Lattner wrote:
> > o Optimization options
> >
> > I agree with the idea of using -O<number> for increasing levels of
> > optimization, with -O0 meaning no optimization.  It's a pretty intuitive
> > scheme, and many Makefiles that use GCC use the -O option.
> 
> The problem is that -O0 does *not* mean no optimization.  In particular,
> with GCC, -O0 runs optimizations that reduce the compile time of the
> program (e.g. DCE) that do not impact the debuggability of the program.
> Making the default option be -O1 would help deal with this, but I'm still
> not convinced that it's a good idea (lots of people have -O0 hard coded
> into their makefiles).  *shrug*

I don't see why we have to maintain 100% compatibility with GCC. We're
so incompatible in so many other ways that I don't see it as a
necessity. For example, we probably won't have all the -f and -X and -W
options that GCC does. So, why can't we just DEFINE the optimization
levels and be done with it? Its not like users of LLVM can just use
their existing makefiles, they will have to make some adjustments. Also,
I don't know of very many people that use -O0. Typical usage is either
no -O option on the command line or -O2, -O3. In those typical use cases
the driver will give them basically what they expect. So I propose:

-O0 = zero optimization, raw output from the front end
-O1 = default fast/lightweight optimization, emphasis on 
        making compilation faster
-O2 = moderate/standard optimization that make significant improvements
        in generated code but don't take significant computation time 
        to optimize
-O3 = aggressive optimization, regardless of computation time with the
        effect of producing the fastest executable
-O4 = life-long optimization, includes -O3 but also profiles and
        re-optimizes

Reid.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040804/491b994d/attachment.sig>


More information about the llvm-dev mailing list