AliasAnalysis supported by the new Pass Manager in v3.9 ?

Looking at the InstructionCombining.cpp code:

PreservedAnalyses InstCombinePass::run(Function &F,
AnalysisManager<Function> &AM) {
auto &AC = AM.getResult<AssumptionAnalysis>(F);
auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);

auto *LI = AM.getCachedResult<LoopAnalysis>(F);

// FIXME: The AliasAnalysis is not yet supported in the new pass manager


What is the question?

Please also note that the new pass manager is not in production, even in 4.0.

OK, the summary question is: in 3.9, how can I use Alias Analysis in a module pass?

The background of the question is: I plan to upgrade from 3.5 to 3.9, and the biggest issue so far seems to be a module pass which requires alias analysis.

The first approach I tried is using the createLegacyPMBasicAAResult followed by createLegacyPMAAResults as in lib/Transforms/IPO/Inliner.cpp. The weird problem I haven’t figured out yet is: this works fine if you just run the pass, but createLegacyPMBasicAAResult will crash with double free with gdb. I have tried using gdb on lib/Transforms/IPO/Inliner.cpp, and that worked fine. My pass is a shared library (.so) and loaded by opt, not sure if that is related. Or maybe related to how the pass is compiled? Will definitely keep digging.

The second and cleaner approach should be using the new pass manager, but as I mentioned in the previous email, based on the FIXME in lib/Transforms/InstCombine/InstructionCombining.cpp code, the alias analysis seems to be not yet supported in the new pass manager. That’s why I asked the question to confirm in the first email.