[LLVMdev] Improving performance with optimization passes
Jon Harrop
jon at ffconsultancy.com
Thu Feb 19 12:01:38 PST 2009
On Thursday 19 February 2009 19:32:14 Gordon Henriksen wrote:
> Hi Jon,
>
> On 2009-02-19, at 14:00, Jon Harrop wrote:
> > I'm toying with benchmarks on my HLVM and am unable to get any
> > performance improvement from optimization passes. I simply copied
> > the use of PassManager from the Kaleidoscope tutorial:
> >
> > Any idea what I might be doing wrong? Has anyone else got this
> > functionality giving performance boosts from OCaml?
>
> That's a pretty barren optimization pipeline.
Right but am I correct in believing that what I have done is pretty much all
that you can do from OCaml right now?
> http://llvm.org/docs/Passes.html
>
> See opt --help and look into what -std-compile-opts is. That's the
> usual starting point for new front ends, although it's a whole-module
> pass pipeline. But it's only a starting point, since it's tuned for
> llvm-gcc's codegen and yours will probably differ.
Thanks.
> > Moreover, some of my programs generate a lot of redundant code (e.g.
> > alloca a struct, store a struct into it and read only one field
> > without using the rest of the struct) and this does not appear to be
> > optimized away.
>
> I think first-class aggregates are mostly used for passing arguments
> in llvm-gcc and clang; maybe mem2reg can't see unravel the loads. Have
> you tried emitting loads and stores of the scalar elements to see if
> mem2reg can eliminate the allocas then?
If I could do that I wouldn't be in this mess! ;-)
I am only generating these temporary structs on the stack because I cannot
load and store struct elements any other way because the OCaml bindings do
not yet have insertvalue and extractvalue.
> P.S. This is not a trivial problem domain. Here's an interesting paper
> on the subject.
>
> COLE: Compiler Optimization Level Exploration
> http://users.elis.ugent.be/~leeckhou/papers/cgo08.pdf
I'll check it out, thanks.
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
More information about the llvm-dev
mailing list