[LLVMdev] [PATCH] & Question: Preserving ProfileInfo for backend.

Andreas Neustifter astifter-llvm at gmx.at
Wed Sep 9 10:47:06 PDT 2009


Shuguang Feng wrote:
> Does the current LLVM backend support reading in profile information
> (without preserving across transformations)? An earlier poster
Yes, it does.

> http://groups.google.com/group/llvm-dev/browse_thread/thread/4bd65dbe84394bb7
> noted that accessing execution counts in a MachineFunction pass (using
> the BasicBlock* corresponding to the respective MachineBasicBlock)
> returned 0 for all blocks.  Running llc with   I
> noticed that the NoProfileInfo pass was being executed.  

Yes, llc currently does not support the loading of profiles, but I
attach a patch that does that, can you try that please?

> I tried
> adding a ProfileLoaderPass in the addPreRegAlloc function of the X86
> target machine to load the profile information but receive the
> following runtime error when the pass manager attempts to add the
> ProfileLoader pass:
> llc: <path to llvm>/llvm/lib/VMCore/PassManager.cpp:1597: virtual void
> llvm::ModulePass::assignPassManager(llvm::PMStack&,
> llvm::PassManagerType): Assertion `!PMS.empty() && "Unable to find
> appropriate Pass Manager"' failed.
> I'm not very familiar with the inner workings of the pass manager
> framework.  Is there a simple fix that can allow existing profile
> information to be loaded by backend passes?  I realize that the
> profile data would not be completely accurate, but as a first order
> approximation it could be useful until the proper framework is
> implemented?

Don't know about Passes in the backend, but this could be a problem of
an FunctionPassManager trying to use a ModulePass.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm-r81350.llc.profile.loader.patch
Type: text/x-patch
Size: 2198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090909/12900261/attachment.bin>

More information about the llvm-dev mailing list