Nema, Ashutosh via llvm-dev
2015-Oct-08 10:11 UTC
[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/c06d337a/attachment.html>
Nema, Ashutosh via llvm-dev
2015-Oct-08 13:22 UTC
[llvm-dev] Using AAResultsWrapperPass in ModulePass
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>