<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 class="Apple-tab-span" style="white-space:pre">       </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 class="Apple-tab-span" style="white-space:pre">  </span>    AU.addRequired<StaticProfilePass>();</b></i></div>
<div><i><b><span class="Apple-tab-span" style="white-space:pre">    </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,</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>The return value of PassRegistry::getPassInfo(const void *TI) is NULL, thus the following dereference of PI is invalid.</div><div>I am using llvm 2.9, which is download from <a href="http://llvm.org/releases/">http://llvm.org/releases/</a>.</div>
<div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>Could anybody help me?</div></div><div><br></div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div><br></div>
-- <br>Best regards,<div><br></div><div>Li Qingan</div><br>
</div>