[LLVMdev] Optimization Levels - Need The Details

Chris Lattner sabre at nondot.org
Sat Aug 14 21:00:30 PDT 2004


On Sat, 14 Aug 2004, Reid Spencer wrote:

> I'm at the point in developing llvmc (Compiler Driver) where I need to
> get the details on the specific optimization arguments that the -O
> family of options should (by default) issue to "opt". I'm soliciting
> your feedback on this so I can start testing optimization. Hopefully you
> can provide it by early this coming week.

Hrm, I don't really know that there is an absolute answer to this.  Some
experimentation will certainly be required.

> For clarity, the -O options are currently defined as:
> -O0 - synonym for -O1
> -O1 - options to speed up compilation, not execution

I'm not sure what would be the best options, but at least -simplifycfg
-mem2reg should be included.

> -O2 - simple/fast module/function optimizations

Probably a subset of what gccas runs.

> -O3 - aggressive module/function optimizations (as well as -O2)

Everything that gccas runs?

> -O4 - simple/fast link time optimizations (as well as -O3)

Everything that gccas and gccld runs.

> -O5 - aggressive link time optimizations (as well as -O4)

For now, the same as -O3, but in the future, I'll add lots of neat stuff
:)

> What I'm looking for is a list of equivalent "opt" options for each of
> the five optimization levels defined above. This supports language front
> ends that don't do their own optimization (e.g. Stacker).

gccas -debug-pass=Arguments will list the passes that are run by the tool.
I don't know that there is a "right" list of options that should be put
in.  Just pick something and we can tune it over time.

-Chris

-- 
http://llvm.org/
http://nondot.org/sabre/




More information about the llvm-dev mailing list