[PATCH] D87743: [NPM] Translate alias analysis into require<> as well
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 22:49:15 PDT 2020
aeubanks created this revision.
aeubanks added reviewers: ychen, asbirlea.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
aeubanks requested review of this revision.
'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<>'.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87743
Files:
llvm/lib/Passes/PassBuilder.cpp
llvm/test/Analysis/GlobalsModRef/no-escape.ll
llvm/tools/opt/NewPMDriver.cpp
Index: llvm/tools/opt/NewPMDriver.cpp
===================================================================
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -336,15 +336,12 @@
}
// 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.
@@ -389,7 +386,7 @@
return false;
}
}
- for (auto PassName : NonAAPasses) {
+ for (auto PassName : Passes) {
std::string ModifiedPassName(PassName.begin(), PassName.end());
if (PB.isAnalysisPassName(PassName))
ModifiedPassName = "require<" + ModifiedPassName + ">";
Index: llvm/test/Analysis/GlobalsModRef/no-escape.ll
===================================================================
--- llvm/test/Analysis/GlobalsModRef/no-escape.ll
+++ 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"
Index: llvm/lib/Passes/PassBuilder.cpp
===================================================================
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -2823,6 +2823,12 @@
#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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87743.292114.patch
Type: text/x-patch
Size: 2389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200916/885a2f5b/attachment.bin>
More information about the llvm-commits
mailing list