[LLVMdev] Using Profile Information

Andreas Neustifter astifter-llvm at gmx.at
Thu Feb 25 13:13:51 PST 2010


On 25.02.2010, at 17:33, ambika wrote:

> How can I use profile information into my pass for performing some  
> analysis.
> I tried something like:
>      PassManager PassMgr = PassManager();
>      cl::opt<std::string> ProfileDataFile(cl::Positional,
> cl::desc("<llvmprof.out file>"),
>                  cl::Optional, cl::init("llvmprof.out"));
>      PassMgr.add(createProfileLoaderPass(ProfileDataFile));
>      PassMgr.run(M);

This does look good to me, I assume you have a debug build? Then use - 
debug-pass=Details to see what is going on in the passmanager.

>      ProfileInfo *PI;
>     PI = &getAnalysis<ProfileInfo>();

This is from the top of my head, but I guess you have to use this  
inside a pass, do you call this in the same module as the previous  
code? Or do you use this inside your profile-guided analysis pass?


More information about the llvm-dev mailing list