Skip to content

Commit

Permalink
[NPM] Translate alias analysis into require<> as well
Browse files Browse the repository at this point in the history
'require<globals-aa>' is needed to make globals-aa work in NPM, since
globals-aa is a module analysis but function passes cannot run module
analyses on demand.
So don't skip translating alias analyses to 'require<>'.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D87743
  • Loading branch information
aeubanks committed Sep 16, 2020
1 parent 06d058a commit 09c3424
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 6 additions & 0 deletions llvm/lib/Passes/PassBuilder.cpp
Expand Up @@ -2823,6 +2823,12 @@ bool PassBuilder::isAnalysisPassName(StringRef PassName) {
#define CGSSC_ANALYSIS(NAME, CREATE_PASS) \
if (PassName == NAME) \
return true;
#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
if (PassName == NAME) \
return true;
#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
if (PassName == NAME) \
return true;
#include "PassRegistry.def"
return false;
}
3 changes: 2 additions & 1 deletion llvm/test/Analysis/GlobalsModRef/no-escape.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -basic-aa -globals-aa -S -licm | FileCheck %s
; RUN: opt < %s -basic-aa -globals-aa -S -licm -enable-new-pm=0 | FileCheck %s
; RUN: opt < %s -basic-aa -globals-aa -S -licm -enable-new-pm=1 | FileCheck %s

target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.10.0"
Expand Down
5 changes: 1 addition & 4 deletions llvm/tools/opt/NewPMDriver.cpp
Expand Up @@ -336,15 +336,12 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
}
// For compatibility with legacy pass manager.
// Alias analyses are not specially specified when using the legacy PM.
SmallVector<StringRef, 4> NonAAPasses;
for (auto PassName : Passes) {
if (PB.isAAPassName(PassName)) {
if (auto Err = PB.parseAAPipeline(AA, PassName)) {
errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
return false;
}
} else {
NonAAPasses.push_back(PassName);
}
}
// For compatibility with the legacy PM AA pipeline.
Expand Down Expand Up @@ -389,7 +386,7 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
return false;
}
}
for (auto PassName : NonAAPasses) {
for (auto PassName : Passes) {
std::string ModifiedPassName(PassName.begin(), PassName.end());
if (PB.isAnalysisPassName(PassName))
ModifiedPassName = "require<" + ModifiedPassName + ">";
Expand Down

0 comments on commit 09c3424

Please sign in to comment.