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
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
But this is already present in my pass.
And I am not able to understand the cause for the error:
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:
Try setting breakpoint in your getAnalysisUsage() and see if it's
actually called. Maybe there's a subtle difference in signature.
Failing that, try breaking on assertion failure and examining it more closely.
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.
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:
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>();
......}
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:
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
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: