<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Tim,<div><br><div><font class="Apple-style-span" color="#315ac6"><br></font><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>From: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Tim Creech <<a href="mailto:tcreech@umd.edu">tcreech@umd.edu</a>></span><br><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Subject: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>[LLVMdev] IVUsers (LoopPass) analysis in a ModulePass?</b></span><br><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Date: </b></span><span style="font-family:'Helvetica'; font-size:medium;">September 1, 2011 11:46:28 AM PDT</span><br><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>To: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a></span><br><blockquote type="cite"></blockquote><font class="Apple-style-span" color="#11761b"><br></font>Hi all,<br> I have a loadable ModulePass which does transformations, and I would like to<br>use IVUsers analysis within it. I noticed when I try to do this (via<br>the usual addRequired<IVUsers>() and getAnalysis<IVUsers>(*F)), opt<br>fails an assert:<br></div></div></div></blockquote><div><br></div><div>All LoopPass, including IVUsers, uses runOnLoop(L, LPM) as an external interface to collect loop analysis or transform a loop. This is the hook used by pass manager. In your case getAnalysis<IVUsers>(*F) (where I assume F is a function ptr) is not what IVUsers supports. This works for FunctionPass because pass manager can do runOnFunction(F).</div><div><br></div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>opt: /home/tcreech/build/llvm-2.9/include/llvm/PassAnalysisSupport.h:239: AnalysisType& llvm::Pass::getAnalysisID(const void*, llvm::Function&) [with AnalysisType = llvm::LoopInfo]: Assertion `ResultPass && "Unable to find requested analysis info"' failed.</div><div><font class="Apple-style-span" color="#11761b"><br></font>...where I was using LoopInfo analysis without trouble before trying to<br>run IVUsers analysis as well. I suspect that I'm somehow doing something<br>that LLVM just doesn't allow. I know that LLVM allows getting<br>FunctionPass analysis from a ModulePass, but can I also get LoopPass<br>analysis from a ModulePass?<br></div></div></div></blockquote></div><br></div><div>As you can image, this is not something that is supported by current pass manager implement.</div><div><br></div><div>Are you sure you need LoopPass to run your ModulePass ? Typically, ModulePass work at a module level e.g. inline functions, change function signatures etc.. Why would a ModulePass need a LoopPass analysis ? I am curious.</div><div><br></div><div>If you're interested in updating pass manager to support your needs then I can give you some hints.</div><div>-</div><div>Devang</div></body></html>