LLVM profiling

Hello,

My name is Rantao Chen and i am a student at the University of Maryland. I am
currently doing some research for a professor to do Basic Block profiling using
LLVM. I have set up the environment correctly and built the profile_rt.so shared
library, but i am having some problems using the LLVM profiling tools.

I run "opt -insert-function-profiling -insert-block-profiling input.bc -o
output.bc" and an output file generates correctly.
I have disassembled the output file and i can see that profiling code has been
added.
I then run "llvm-prof -A output.bc -o llvmprof.out".
For some reason, nothing gets written to llvmprof.out; instead everything is
written to the terminal window. At the very top, i get a message saying
"function counts are not available" and every basic block has an execution count
of 0.

Am i doing something wrong or am i missing an option flag somewhere? If
anyone could offer any help or suggestions on why this is happening and/or
how to get basic block profiling working, i would greatly appreciate it.

Thanks in advance.

-Rantao Chen

Hi Rantao,

perhaps you should use $llvmpath/utils/profile.pl for profiling? It works well. If you don't want to use it, there is at least some code in the script that should help you.

BTW: I'm not sure if it is possible to instrument the bitcode with function and basic block code at the same time.
But it should work sequential (data in llvmprof.out are accumulated after each run - not deleted)

Ciao,
Nico

Hi Rantao,

perhaps you should use $llvmpath/utils/profile.pl for profiling? It
works well. If you don't want to use it, there is at least some code
in the script that should help you.

BTW: I'm not sure if it is possible to instrument the bitcode with
function and basic block code at the same time.

I don't know about now, but it use to be possible.

Andrew