[llvm-dev] Branch profiling in older llvm revision

Deepak Rajendrakumaran via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 29 10:07:48 PDT 2016

Hi All,

My apologies for the long winded post in advance.

I need to obtain branch data(execution count of each block would work as
well) for my machine function pass. The catch is I am using LLVM 3.1(can't
update to later revision due to external factors) with DragonEGG and cross
compiling it with GCC 32 bit arm tool chain.

The only option I see is using "-insert-edge-profiling" with
"--profile-loader". Because of complications with my toolchain, I am not
really sure I can use it as it. If any of you have worked with this, can
you point me to some/any documentation showing what happens in the backend
when using these?

The only useful information I can find on these are from previous questions
people have asked(
https://groups.google.com/forum/#!topic/llvm-dev/vJ2wDsQY6a4 being one of
them). The steps from what I can understand are:

opt -insert-edge-profiling -O3 foo.bc -o foo.2.bc
run the compiled binary using llvm-prof after linking with lprofile_rt
opt -profile-loader        -O3 foo.bc -o foo.opt.bc //the required info can
be obtained using this pass.

Because I cross compile the binary, I am using gem5 to run it. This means,
I have a problem since I have an arm binary I need to execute and x86
llvm tool(llvm-prof in this case).Theoretically, I should be able to

a)Compile the binary for host with the first pass(one with opt
-insert-edge-profiling) and run it using llvm-prof

b) Compile again with arm backend  with only the second pass(

Since the llvm bit code should be architecture independent. Is this an
option? Has anyone tried this?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160729/91419df1/attachment.html>

More information about the llvm-dev mailing list