Maybe you could use the available profilers (i.e edge profiler, path profiler...) to generate instrumented code, enabling and disabling the optimizations you want to test, and then  make the comparison (assuming you can actually disable the optimizations of interest without compromising later passes). You could modify the profilers to collect information that is more interesting for you as well. <br>
<br><div class="gmail_quote">On Sun, Oct 9, 2011 at 6:38 AM, bejer <span dir="ltr"><<a href="mailto:bejerdk@gmail.com">bejerdk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
I want to measure the performance of functions within a program, in<br>
order to see whether or not a given set of optimizations are useful<br>
(making the code faster in my case). It would be ideal to compare the<br>
LLVM IR representation of the functions before and after the<br>
optimizations, but the process has to be automatized so if there is no<br>
code that can do this now then I guess it will be too hard to come up<br>
with good heuristics for comparing the code with respect to execution<br>
performance.<br>
My current approach would be to use a profiler, such as<br>
google-perftools, but the information acquired suffers from some<br>
inaccuracy.<br>
However I would like to hear your take on it and maybe if I should<br>
implement the measurement mechanism in an interpreter (lli) that uses<br>
a high resolution timer for entering and exiting functions. But it<br>
depends on if the performance of the executed LLVM IR code in lli is<br>
reflective on the performance from native compiled code, such that it<br>
can be tested if a set of optimizations are useful or not. Or would it<br>
be more desirable to make a pass that inserts code to activate and<br>
deactivate a timer on function entry and exit?<br>
<br>
Cheers, Michael<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>[Carolina Simões Gomes]<br>M.Sc. Student in Computing Science<br>University of Alberta, Canada<div>CAS Partner - IBM Toronto<br>+1 (780) 863-0155<br><br></div>
<br>