[LLVMdev] problem with analysis required

Andreas Neustifter e0325716 at student.tuwien.ac.at
Fri May 8 08:05:01 PDT 2009


Hi,

Kshitiz Garg wrote:
> Hello,
>     I was trying to get the loop info in a module pass to be able to
> iterate over the loops int the module itself. Since my pass requires
> to make module level changes including adding new types to module
> hence a looppass cannot be used here.
> I am getting the following error on running opt.
> 
> opt: /root/llvm-2.4/include/llvm/PassAnalysisSupport.h:199:
> AnalysisType& llvm::Pass::getAnalysisID(const llvm::PassInfo*) const
> [with AnalysisType = llvm::LoopInfo]: Assertion `ResultPass &&
> "getAnalysis*() called on an analysis that was not " "'required' by
> pass!"' failed.
> 
> <snip_gdb_trace>
> #4  0x083006f2 in llvm::Pass::getAnalysisID<llvm::LoopInfo> (this=0x86cfc48,
>     PI=0x86cbfe0) at /root/llvm-2.4/include/llvm/PassAnalysisSupport.h:197
> #5  0x083007aa in llvm::Pass::getAnalysis<llvm::LoopInfo> (this=0x86cfc48)
>     at /root/llvm-2.4/include/llvm/PassAnalysisSupport.h:186
> #6  0x0056e1c0 in runOnModule (this=0x86cfc48, M=@0x86cfeb8) at timing.cpp:167
> </snip_gdb_trace>
> gdb backtrace points to the following statement in the runOnModule method;
> Loopinfo * LI = &getAnalysis<LoopInfo>();
> 
> following is the content of the getAnalysis Usage method.
> 
>  void getAnalysisUsage(AnalysisUsage &AU) const {
>             AU.addRequired<LoopInfo> ();
>             AU.addPreserved<LoopInfo> ();
> }
> 
> I picked this from the LPPassManager class which has a similar
> structure and its runOnFunction iterates over loop list from LoopInfo.
> 
> I think I am missing some line to add. Can someone please point out
> the cause of the error??

Funny enough I stumbled over the same problem right now. I have no solution either but I will post a follow-up if I find something out.

Andi



More information about the llvm-dev mailing list