我正在尝试将我的项目从llvm3.6.2迁移到llvm3.8.1。在我的代码中,我使用了AliasAnalysis,我正在更改我的代码如下:
#if defined(DDP_LLVM_VERSION_3_8)
AU.addRequired<AAResultsWrapperPass>();
#else
AU.addRequired<AliasAnalysis>();
#endif
我将AliasAnalysis传递给函数如下:
#if defined(DDP_LLVM_VERSION_3_8)
foo(*F,getAnalysis<AAResultsWrapperPass>().getAAResults());
#else
foo(*F,getAnalysis<AliasAnalysis>());
#endif
功能声明如下:
void foo(Function &F, AliasAnalysis &AA);
此代码已正确编译。但是当我运行这个时,我会遇到以下错误。
#0 0x0000000001558e19 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/llvm/llvm-3.8/llvm-3.8.1.src/lib/Support/Unix/Signals.inc:322:0
#1 0x0000000001559195 PrintStackTraceSignalHandler(void*) /home/llvm/llvm-3.8/llvm-3.8.1.src/lib/Support/Unix/Signals.inc:380:0
#2 0x00000000015578f6 llvm::sys::RunSignalHandlers() /home/llvm/llvm-3.8/llvm-3.8.1.src/lib/Support/Signals.cpp:44:0
#3 0x000000000155891d SignalHandler(int) /home/llvm/llvm-3.8/llvm-3.8.1.src/lib/Support/Unix/Signals.inc:210:0
#4 0x00007f7d30b5b370 __restore_rt (/lib64/libpthread.so.0+0xf370)
#5 0x0000000000b04251 llvm::AAResultsWrapperPass& llvm::Pass::getAnalysisID<llvm::AAResultsWrapperPass>(void const*) const /home/llvm/llvm-3.8/install/include/llvm/PassAnalysisSupport.h:242:0
#6 0x0000000000b04251 llvm::AAResultsWrapperPass& llvm::Pass::getAnalysis<llvm::AAResultsWrapperPass>() const /home/llvm/llvm-3.8/install/include/llvm/PassAnalysisSupport.h:223:0
答案 0 :(得分:0)
我从模块传递中调用了getAnalysis<AAResultsWrapperPass>().getAAResults()
。将当前函数作为参数传递给该函数解决了这个问题。
getAnalysis<AAResultsWrapperPass>().getAAResults()
- 不工作
getAnalysis<AAResultsWrapperPass>().getAAResults(F)
- 工作