[LLVMdev] Improving performance with optimization passes
Dan Gohman
gohman at apple.com
Thu Feb 19 11:44:47 PST 2009
To add to what Gordon said, the SROA pass, aka -scalarrepl, aka
scalar replacement of aggregates, is the main pass which splits
struct allocas into fields that the rest of the optimizer can
work with.
Dan
On Feb 19, 2009, at 11:00 AM, Jon Harrop wrote:
>
> I'm toying with benchmarks on my HLVM and am unable to get any
> performance
> improvement from optimization passes. 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 simply copied the use of PassManager from the Kaleidoscope tutorial:
>
> let pm = PassManager.create_function mp in
> TargetData.add (ExecutionEngine.target_data ee) pm;
>
> add_constant_propagation pm;
>
> (* Do simple "peephole" optimizations and bit-twiddling optzn. *)
> add_instruction_combining pm;
>
> (* reassociate expressions. *)
> add_reassociation pm;
>
> (* Eliminate Common SubExpressions. *)
> add_gvn pm;
>
> (* Simplify the control flow graph (deleting unreachable blocks,
> etc). *)
> add_cfg_simplification pm;
>
> add_memory_to_register_promotion pm;
>
> and then I apply "PassManager.run_function" to every function after
> it is
> validated.
>
> Any idea what I might be doing wrong? Has anyone else got this
> functionality
> giving performance boosts from OCaml?
>
> --
> Dr Jon Harrop, Flying Frog Consultancy Ltd.
> http://www.ffconsultancy.com/?e
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list