[LLVMdev] Improving performance with optimization passes
Jon Harrop
jon at ffconsultancy.com
Thu Feb 19 11:00:14 PST 2009
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
More information about the llvm-dev
mailing list