how to get path profile information ?

Dear all,

I have already checked some related posted messages, such as: and

After getting rid of some error messages, I was able to run the following commands:

  1. opt -insert-path-profiling matmul.bc -o matmul.pp.bc
  2. lli -load …/llvm_build/Debug+Asserts/lib/ matmul.pp.bc (generates llvmprof.out file)

and as a last command:
3) opt -path-profile-loader -profile-info-file=llvmprof.out matmul.pp.bc -analyze

which provides the following output:

Printing analysis ‘Load path profile information from file’:
Pass::print not implemented for pass: ‘Path Profiling Information Loader’!

After trying several options, this is where i was able to reach, but still it does not provide what i need.

I am a bit confused about which commands to apply and in which order and with which parameters.
Maybe someone who is already using path profiling can provide me some useful information.

Thanks in advance.

What version of LLVM are you using? The profiling framework is completely messed up in the newer versions of LLVM… I used to work with profiling in 2.5 some time ago, and it seemed to work fine… If you really need this to work quickly, you might want to just get the old version and get on with it…

The newer versions of LLVM need to get the profiling part fixed soon…It is messing up my work as well…I am trying to fix it now… If you could give me the exact details of the error and your steps, I might be able to work it out…



Currently, I am working with version 3.0. I think it would be useful to make it work with new versions.

What i want to do is to apply edge and path profiling as it is explained in this report:

Regarding the

  1. naive edge profiling: (with -insert-edge-profiling)

opt -insert-edge-profiling -o matmul.ep.bc matmul.bc
lli -load …/lvm_build/Debug+Asserts/lib/ matmul.ep.bc
llvm-prof -annotated-llvm matmul.ep.bc

It seems ok. If you check output, you will see edge annotations are inserted in llvm-ir code. I do not think there is a formatted output for edge profiling ? (even though it says that there is a pass called -dot-edge-numbers (suppose to provide dot graph with edge annotations) in the document, the pass is not in current llvm dist. )

Or alternatively, one can run script: -annotated-llvm matmul.bc

  1. optimal edge profiling

opt -insert-optimal-edge-profiling -o matmul.oep.bc matmul.bc
lli -load …/lvm_build/Debug+Asserts/lib/ matmul.oep.bc
llvm-prof -annotated-llvm matmul.oep.bc

or alternatively -annotated-llvm matmul.bc, but before running script, i modified the pass as

my $ProfilePass = “-insert-optimal-edge-profiling”;

both seems working well.

  1. Path profiling:

If i try to apply the command as i applied for edge profiling

opt -insert-path-profiling -o matmul.pp.bc matmul.bc
lli -load …/llvm_build/Debug+Asserts/lib/ matmul.pp.bc (produces llvmprof.out successfully)
llvm-prof matmul.pp.bc
llvm-prof: Unknown packet type #5!

I searched that line in the code, and found out that it is in llvm/lib/Analysis/ProfileInfoLoader.cpp

errs() << ToolName << “: Unknown packet type #” << PacketType << “!\n”;

This is where i stuck!

Furthermore, opt has some passes like:

-path-profile-loader - Load path profile information from file
-path-profile-verifier - Compare the path profile derived edge profile against the edge profile.

I have tried to use them, but, indeed, I am not sure how to use them.

I hope i made it clear enough my problem, your comments are very welcome.