[LLVMdev] [Fwd: Error while running my pass with opt]

ambika ambika at cse.iitb.ac.in
Sun May 9 06:07:08 PDT 2010


Here is getAnalysisUsage() i am using,

   void getAnalysisUsage(AnalysisUsage &AU) const {
      AU.setPreservesAll();
      AU.addRequired<DominatorTree>();
    }

and then I use it as,


bool ptrTest::runOnModule(Module &M) {

  DominatorTree &DT = getAnalysis<DominatorTree>();
  ......

}

John Criswell wrote:
> ambika wrote:
>> But this is already present in my pass.
>> And I am not able to understand the cause for the error:
>>   
>
> Can you send a copy of your getAnalysisUsage() method for your pass?  
> There are some funny errors that can occur when you do things that the 
> PassManager cannot handle.
>
> For example, if you're requiring a transform pass, that can cause 
> strange assertions from the PassManager.  Requiring a BasicBlock pass 
> from a FunctionPass might also hit assertions within PassManager (I 
> think).
>
> If you post your getAnalysisUsage() method, I can take a quick look to 
> see if you're doing something that I know is unsupported by PassManager.
>
> -- John T.
>
>> opt: 
>> /home/ambika/llvm_3/llvm-2.6/include/llvm/PassAnalysisSupport.h:203: 
>> AnalysisType& llvm::Pass::getAnalysisID(const llvm::PassInfo*) const 
>> [with AnalysisType = llvm::DominatorTree]: Assertion `ResultPass && 
>> "getAnalysis*() called on an analysis that was not " "'required' by 
>> pass!"' failed.
>>
>> What can possibly cause this. Any ideas will also help.
>>
>> Tobias Grosser wrote:
>>  
>>> Hi,
>>>
>>> you need something like this in your pass:
>>>
>>> void YourPass::getAnalysisUsage(AnalysisUsage &AU) const {
>>>   AU.addRequired<DominatorTree>();
>>> }
>>>
>>> because you need to specify which analysis you are using.
>>>
>>> Tobi
>>>     
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>   
>




More information about the llvm-dev mailing list