I’m trying to use alias analysis in a pass written for the new pass manager in LLVM.
PreservedAnalyses run(Module &m, ModuleAnalysisManager &mam) {
auto &aa = mam.getResult<AAManager>(m);
analysis(aa, m);
return PreservedAnalyses::all();
}
In my pass, I use mam.getResult
(which appears to be equivalent to getAnalysis<AliasAnalysis>()
for the old pass), however, the pass manager wants me to register the analysis first:
Assertion `AnalysisPasses.count(PassT::ID()) && "This analysis pass was not registered prior to being queried"' failed.
I couldn’t find any documentation on how to do that. The closest I came to the solution was this question on the mailing list, but the response wasn’t very helpful.
How do I register the analysis pass?