Block profiling in LLVM

I am trying to profile my code with -enable-block -profile option on opt command.

It returns no such option available. I have also explored the opt help and found
that there is really no block profiling option. I only found edge profiling.

I want to identify total number of blocks along with block occurrence in my

I'm new in using LLVM.

Please help me.

Hi Rajendra,

You don't mention how you want to use the data, but if it is within a compiler then block profiling information can be trivially derived from edge profiling information. For each block just sum every incoming edge to obtain the number of times that block was executed.

If you wish to do profiling for performance monitoring then llvm-prof can tell you the hottest parts of your code. Or, 'llvm-prof -A' prints your entire program with ";;; Basic block executed N times." annotations.