[llvm-dev] How to get the loop hotness data in a suite ?

Stefanos Baziotis via llvm-dev
Thu, 01 Oct 2020 00:44:45 -0000

Hi everybody,

I'm trying to get loop hotness data across a suite (e.g. the llvm
test-suite). Ideally,
this would be a list that for each loop would list how many times it was
entered and what
was its iteration count (at least the latter). The closest thing I could
come up with is:
- clang -fprofile-instr-generate (without opts) to get a .profraw
- Get the .profdata
- Give that back to clang with -fprofile-instr-use and generate .ll
- I note that here we get "branch_weights" stats, so if a branch is a
back-edge,
it basically gives us the iteration count. For example, check the bottom of
this file: https://pastebin.com/ZnQqJdTN which was created with the
procedure above.
- Then, create a custom pass that goes through every loop and gathers this
"branch_weights" data.

I feel like this is both not very accurate and overly complicated for
something that I
guess a lot of people probably have needed to gather in the past. Is there
an easier
solution?

Thanks,
Stefanos
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20200930/53b785d8/attachment.html>