<div dir="ltr"><div dir="ltr">Hi everybody,<br><br>I'm trying to get loop hotness data across a suite (e.g. the llvm test-suite). Ideally,<br>this would be a list that for each loop would list how many times it was entered and what<br>was its iteration count (at least the latter). The closest thing I could come up with is:<br>- clang -fprofile-instr-generate (without opts) to get a .profraw<br>- Get the .profdata<br>- Give that back to clang with -fprofile-instr-use and generate .ll<br>- I note that here we get "branch_weights" stats, so if a branch is a back-edge,<br>it basically gives us the iteration count. For example, check the bottom of this file: <a href="https://pastebin.com/ZnQqJdTN">https://pastebin.com/ZnQqJdTN</a> which was created with the procedure above.<br>- Then, create a custom pass that goes through every loop and gathers this "branch_weights" data.<br><br>I feel like this is both not very accurate and overly complicated for something that I<br>guess a lot of people probably have needed to gather in the past. Is there an easier<br>solution?<br><br>Thanks,<br>Stefanos</div></div>