<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 30, 2011, at 2:15 AM, Qingan Li wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Qingan Li</b> <span dir="ltr"><<a href="mailto:ww345ww@gmail.com">ww345ww@gmail.com</a>></span><br>Date: 2011/5/30<br>
Subject: <br>To: <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br><br><br><br clear="all">Hi,<div><br></div><div>I wrote an analysis pass, myPass, inherited from both  ModulePass and ProfileInfo, and this pass requires the CallGraph, i.e.,</div>
<div><div><b><i>  class myPass : public ModulePass, public ProfileInfo { ...};</i></b></div>
</div><div><b><i>  void myPass::getAnalysisUsage(AnalysisUsage &AU) const {</i></b></div><div><div><b><i>  AU.addRequired<CallGraph>();</i></b></div><div><b><i>  AU.setPreservesAll();</i></b></div><div><b><i>}</i></b></div>

<div><br></div><div>Then, I assumes the UnreachableBlockElim (inherited from FunctionPass) requires myPass, by revising the related function as follows:</div><div><div> <i><b>UnreachableBlockElim::getAnalysisUsage(AnalysisUsage &AU) const {<span style="white-space:pre-wrap">      </span></b></i></div>

<div><i><b>      AU.addPreserved<DominatorTree>();</b></i></div><div><i><b>      AU.addPreserved<ProfileInfo>();</b></i></div><div><i><b><span style="white-space:pre-wrap">      </span>    AU.addRequired<StaticProfilePass>();</b></i></div>

<div><i><b><span style="white-space:pre-wrap">        </span>  </b></i></div><div><i><b>    }</b></i></div></div><div><br></div><div>Then, i built it, it is OK. I went on to run it. It failed with a segment error.</div>
<div>By debugging, it is found that in the following code from <i><b>PMTopLevelManager::schedulePass(Pass *P)</b></i>,</div><div><div>        <i><b>const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(*I);</b></i></div>
<div><i><b>        AnalysisPass = PI->createPass();</b></i></div>
</div><div><br></div><div>When this manager search for the CallGraph reqiured by myPass ( in the failing trace , Pass *P is myPass), the return value of <i><b>PassRegistry::getPassInfo(const void *TI)</b></i> is NULL, thus the following dereference of PI is invalid.</div></div></div></blockquote><div><br></div><div>This may be a limitation of pass manager. Please file a bug report with a reproducible test case. Thanks!</div><div>-</div><div>Devang</div><div><br></div><br><blockquote type="cite"><div class="gmail_quote"><div>
<div>I am using llvm 2.9, which is download from <a href="http://llvm.org/releases/" target="_blank">http://llvm.org/releases/</a>.</div>
<div><div>Could anybody help me?</div></div><div><br></div><div><br></div><div><br></div>
-- <br>Best regards,<div><br></div><div>Li Qingan</div><br>
</div>
</div><br><br clear="all"><br>-- <br>Best regards,<div><br></div><div>Li Qingan</div><br>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br></body></html>