[LLVMdev] counting branch frequencies
alastairmurray42 at gmail.com
Wed Sep 12 19:20:09 PDT 2012
On 11/09/12 11:20, apala guha wrote:
> Is it possible to associate the branch frequency counts with the basic
> in the intermediate representation? (e.g. Can I access basic block
> frequencies in runOnFunction()?)
Profile data really needs to be loaded at a module level, but once this
has been done it can be accessed at any level (including function).
In LLVM 3.1 ProfileInfo stores block execution frequencies (use
For LLVM svn you can look at BlockFrequencyInfo, which I generates its
data from BranchFrequencyInfo, which in turn uses the branch weight
metadata (set by -profile-metadata-loader). I haven't actually tried
this though, so I'm not sure how accurately the block frequencies are
> Also, I was able to produce a 'llvmprof.out' file. What is the format of
> this file? How can I parse it?
Very roughy the format of the file is lots of unsigned integers.
-profile-loader or -preofile-metadata-loader will parse it for you.
Parsing outside of LLVM is tricky as it relies on exact ordering of
More information about the llvm-dev