本文介绍了在llvm3.8.1中使用AAResultsWrapperPass时出现分段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将项目从llvm3.6.2迁移到llvm3.8.1.在我的代码中,我使用了AliasAnalysis,并且正在如下更改我的代码:

I am trying to migrate my project from llvm3.6.2 to llvm3.8.1. In my code, I have used AliasAnalysis and I am changing my code as follows:

#if defined(DDP_LLVM_VERSION_3_8)
AU.addRequired<AAResultsWrapperPass>();
#else
AU.addRequired<AliasAnalysis>();
#endif

我将AliasAnalysis传递给该函数,如下所示:

And I am passing AliasAnalysis to the function as follow:

#if defined(DDP_LLVM_VERSION_3_8)
foo(*F,getAnalysis<AAResultsWrapperPass>().getAAResults());
#else
foo(*F,getAnalysis<AliasAnalysis>());
#endif

函数声明如下:

void foo(Function &F, AliasAnalysis &AA);

此代码正在正确编译.但是当我运行此命令时,出现以下错误.

This code is getting compiled properly. But when I run this, I am getting following errors.

#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

推荐答案

我正在从模块传递中调用getAnalysis<AAResultsWrapperPass>().getAAResults().将当前函数作为参数传递给该函数可以解决此问题.

I was calling getAnalysis<AAResultsWrapperPass>().getAAResults() from a module pass. Passing current function as argument to this function solved the issue.

getAnalysis<AAResultsWrapperPass>().getAAResults()-不起作用getAnalysis<AAResultsWrapperPass>().getAAResults(F)-工作中

getAnalysis<AAResultsWrapperPass>().getAAResults() - NOT workinggetAnalysis<AAResultsWrapperPass>().getAAResults(F)- working

这篇关于在llvm3.8.1中使用AAResultsWrapperPass时出现分段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-10 21:39