[llvm-dev] Using AAResultsWrapperPass in ModulePass
Nema, Ashutosh via llvm-dev
llvm-dev at lists.llvm.org
Thu Oct 8 03:11:37 PDT 2015
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>
More information about the llvm-dev
mailing list