3

我正在编写模块级传递,并且在runOnModule函数内部我有以下代码:

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);
  }
}

}

这一切都可以编译,但是当我运行它时,出现以下错误:

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.

我尝试将下面的代码放在 lib/Transforms/IPO/PassManagerBuilder.cpp in thepopulateModulePassManager 方法中,但什么也没发生。

if (EnableMergeFunctions) {
MPM.add(createMergeFunctionsPass());
MPM.add(createJumpThreadingPass()); // Merge consecutive conditionals
MPM.add(createInstructionCombiningPass());
MPM.add(createCFGSimplificationPass());

}

任何帮助都会非常感谢。

4

0 回答 0