[llvm-dev] Using AAResultsWrapperPass in ModulePass

Nema, Ashutosh via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 8 06:22:37 PDT 2015


Ah, I got it. 'createLegacyPMAAResults' can help here.

Regards,
Ashutosh

From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Nema, Ashutosh via llvm-dev
Sent: Thursday, October 08, 2015 3:42 PM
To: llvm-dev
Subject: [llvm-dev] Using AAResultsWrapperPass in ModulePass

Hi,

Did anyone faced any issues with the recent changes made for AliasAnalysis.
AliasAnalysis interface changed to AAResultsWrapperPass.
Prior was able to use AliasAnalysis in module pass, now facing error while using AAResultsWrapperPass:

ld: /home/ashutosh/I2DPromo/llvm/include/llvm/PassAnalysisSupport.h:230: AnalysisType& llvm::Pass::getAnalysisID(llvm::AnalysisID) const [with AnalysisType = llvm::AAResultsWrapperPass; llvm::AnalysisID = const void*]: Assertion `ResultPass && "getAnalysis*() called on an analysis that was not " "'required' by pass!"' failed.
clang: error: unable to execute command: Aborted (core dumped)

AAResultsWrapperPass is a FunctionPass. Is that the reason this can't be used in ModulePass ?

Looks like I'm missing something, can anyone help to get AliasAnalysis in ModulePass ?

Usage:
class myclass: public ModulePass {
public:
void getAnalysisUsage(AnalysisUsage &AU) const override {
    AU.addRequired<AAResultsWrapperPass>();
    AU.setPreservesAll();
  }
}
bool  myclass::runOnModule(Module &M) {
  AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
}
INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)

Regards,
Ashutosh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151008/c34b1dba/attachment.html>


More information about the llvm-dev mailing list