I'm writing a module level pass and inside the runOnModule
function I have the following bit of code:
for (Module::iterator F = M.begin(), FEND = M.end(); F != FEND; ++F){
if (!(*F).isDeclaration()){
LoopInfo* LI = new LoopInfo();
LI->runOnFunction(*F);
lis.push_back(LI);
for(LoopInfo::iterator L = LI->begin(), LEND = LI->end(); L != LEND; ++L){
// add all functions
loops.push_back(*L);
}
}
}
This all compiles but when I run it I get the following error:
opt: /include/llvm/PassAnalysisSupport.h:200: AnalysisType
&llvm::Pass::getAnalysis() const [AnalysisType = llvm::DominatorTreeWrapperPass]:
Assertion `Resolver && "Pass has not been inserted into a PassManager object!"' failed.
I tried putting the below code in ``lib/Transforms/IPO/PassManagerBuilder.cppin the
populateModulePassManager` method but nothing happened.
if (EnableMergeFunctions) {
MPM.add(createMergeFunctionsPass());
MPM.add(createJumpThreadingPass()); // Merge consecutive conditionals
MPM.add(createInstructionCombiningPass());
MPM.add(createCFGSimplificationPass());
}
Any help would be great thanks.