[LLVMdev] about writing a functionpass requiring a modulepass
Devang Patel
dpatel at apple.com
Tue May 31 10:28:47 PDT 2011
On May 30, 2011, at 2:15 AM, Qingan Li wrote:
>
>
> ---------- Forwarded message ----------
> From: Qingan Li <ww345ww at gmail.com>
> Date: 2011/5/30
> Subject:
> To: llvmdev at cs.uiuc.edu
>
>
>
> Hi,
>
> I wrote an analysis pass, myPass, inherited from both ModulePass and ProfileInfo, and this pass requires the CallGraph, i.e.,
> class myPass : public ModulePass, public ProfileInfo { ...};
> void myPass::getAnalysisUsage(AnalysisUsage &AU) const {
> AU.addRequired<CallGraph>();
> AU.setPreservesAll();
> }
>
> Then, I assumes the UnreachableBlockElim (inherited from FunctionPass) requires myPass, by revising the related function as follows:
> UnreachableBlockElim::getAnalysisUsage(AnalysisUsage &AU) const {
> AU.addPreserved<DominatorTree>();
> AU.addPreserved<ProfileInfo>();
> AU.addRequired<StaticProfilePass>();
>
> }
>
> Then, i built it, it is OK. I went on to run it. It failed with a segment error.
> By debugging, it is found that in the following code from PMTopLevelManager::schedulePass(Pass *P),
> const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(*I);
> AnalysisPass = PI->createPass();
>
> When this manager search for the CallGraph reqiured by myPass ( in the failing trace , Pass *P is myPass), the return value of PassRegistry::getPassInfo(const void *TI) is NULL, thus the following dereference of PI is invalid.
This may be a limitation of pass manager. Please file a bug report with a reproducible test case. Thanks!
-
Devang
> I am using llvm 2.9, which is download from http://llvm.org/releases/.
> Could anybody help me?
>
>
>
> --
> Best regards,
>
> Li Qingan
>
>
>
>
> --
> Best regards,
>
> Li Qingan
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110531/11649660/attachment.html>
More information about the llvm-dev
mailing list