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

ambika ambika at cse.iitb.ac.in
Tue May 11 10:07:30 PDT 2010


Yaah Dominator tree is generated per function. It worked out when I used 
it as

   AU.addRequired<DominatorTree>(F);

Thanks to all for helping me.

Nick Lewycky wrote:
> John Criswell wrote:
>> ambika wrote:
>>> 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>();
>
> DominatorTree is per-function. In a ModulePass you need to pass a 
> Function in order for it to know which function you want the 
> DominatorTree for.
>
> Nick
>
>>>    ......
>>>
>>> }
>>>
>>
>> Weird.  There is nothing unusual about your getAnalysisUsage() method at
>> all.
>>
>> I assume ptrTest is either a ModulePass or FunctionPass, correct?
>>
>> A few other questions:
>>
>> 1) Is ptrTest part of an analysis group?
>>
>> 2) Does ptrTest has a static ID member whose address is passed into its
>> constructor as a default parameter?  The code should look something like
>> this:
>>
>> public :
>>      static char ID;
>>      ptrTest () : FunctionPass ((intptr_t)&ID) { }
>>
>>
>> -- John T.
>>
>>> 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
>>>>>
>>>>>
>>>
>>>
>>
>> _______________________________________________
>> 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