[LLVMdev] Comparison of optimizations

bejer bejerdk at gmail.com
Sun Oct 9 05:38:54 PDT 2011


I want to measure the performance of functions within a program, in
order to see whether or not a given set of optimizations are useful
(making the code faster in my case). It would be ideal to compare the
LLVM IR representation of the functions before and after the
optimizations, but the process has to be automatized so if there is no
code that can do this now then I guess it will be too hard to come up
with good heuristics for comparing the code with respect to execution
My current approach would be to use a profiler, such as
google-perftools, but the information acquired suffers from some
However I would like to hear your take on it and maybe if I should
implement the measurement mechanism in an interpreter (lli) that uses
a high resolution timer for entering and exiting functions. But it
depends on if the performance of the executed LLVM IR code in lli is
reflective on the performance from native compiled code, such that it
can be tested if a set of optimizations are useful or not. Or would it
be more desirable to make a pass that inserts code to activate and
deactivate a timer on function entry and exit?

Cheers, Michael

More information about the llvm-dev mailing list