diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2016-02-13 23:32:00 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2016-02-13 23:32:00 +0000 |
| commit | 6f5770b10f85958b53d9638c560c0e918a8ad239 (patch) | |
| tree | 475458a1539b5c9f96debef8481724b2dc32ea6f /llvm | |
| parent | 3f7f883e060923a0844971e0a8a16e459ef9e099 (diff) | |
| download | bcm5719-llvm-6f5770b10f85958b53d9638c560c0e918a8ad239.tar.gz bcm5719-llvm-6f5770b10f85958b53d9638c560c0e918a8ad239.zip | |
[PM/AA] Actually wire the AAManager I built for the new pass manager
into the new pass manager and fix the latent bugs there.
This lets everything live together nicely, but it isn't really useful
yet. I never finished wiring the AA layer up for the new pass manager,
and so subsequent patches will change this to do that wiring and get AA
stuff more fully integrated into the new pass manager. Turns out this is
necessary even to get functionattrs ported over. =]
llvm-svn: 260836
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/Analysis/AliasAnalysis.h | 12 | ||||
| -rw-r--r-- | llvm/lib/Analysis/AliasAnalysis.cpp | 3 | ||||
| -rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 1 | ||||
| -rw-r--r-- | llvm/lib/Passes/PassRegistry.def | 1 | ||||
| -rw-r--r-- | llvm/test/Other/new-pass-manager.ll | 8 |
5 files changed, 23 insertions, 2 deletions
diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h index d63e7b0ddad..775d994dcd0 100644 --- a/llvm/include/llvm/Analysis/AliasAnalysis.h +++ b/llvm/include/llvm/Analysis/AliasAnalysis.h @@ -983,6 +983,12 @@ class AAManager { public: typedef AAResults Result; + /// \brief Opaque, unique identifier for this analysis pass. + static void *ID() { return (void *)&PassID; } + + /// \brief Provide access to a name for this pass. + static StringRef name() { return "AAManager"; } + // This type hase value semantics. We have to spell these out because MSVC // won't synthesize them. AAManager() {} @@ -1004,14 +1010,16 @@ public: FunctionResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>); } - Result run(Function &F, AnalysisManager<Function> &AM) { + Result run(Function &F, AnalysisManager<Function> *AM) { Result R; for (auto &Getter : FunctionResultGetters) - (*Getter)(F, AM, R); + (*Getter)(F, *AM, R); return R; } private: + static char PassID; + SmallVector<void (*)(Function &F, AnalysisManager<Function> &AM, AAResults &AAResults), 4> FunctionResultGetters; diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp index a30aedc4060..937841f206f 100644 --- a/llvm/lib/Analysis/AliasAnalysis.cpp +++ b/llvm/lib/Analysis/AliasAnalysis.cpp @@ -390,6 +390,9 @@ bool AAResults::canInstructionRangeModRef(const Instruction &I1, // Provide a definition for the root virtual destructor. AAResults::Concept::~Concept() {} +// Provide a definition for the static object used to identify passes. +char AAManager::PassID; + namespace { /// A wrapper pass for external alias analyses. This just squirrels away the /// callback used to run any analyses and register their results. diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 8ba81f72a71..66457633bba 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -16,6 +16,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Passes/PassBuilder.h" +#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/CGSCCPassManager.h" #include "llvm/Analysis/LazyCallGraph.h" diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def index 241a78927c7..5a3d63a6a78 100644 --- a/llvm/lib/Passes/PassRegistry.def +++ b/llvm/lib/Passes/PassRegistry.def @@ -53,6 +53,7 @@ CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass()) #ifndef FUNCTION_ANALYSIS #define FUNCTION_ANALYSIS(NAME, CREATE_PASS) #endif +FUNCTION_ANALYSIS("aa", AAManager()) FUNCTION_ANALYSIS("assumptions", AssumptionAnalysis()) FUNCTION_ANALYSIS("domtree", DominatorTreeAnalysis()) FUNCTION_ANALYSIS("loops", LoopAnalysis()) diff --git a/llvm/test/Other/new-pass-manager.ll b/llvm/test/Other/new-pass-manager.ll index fb84e787a0a..b3f5e5a6bcc 100644 --- a/llvm/test/Other/new-pass-manager.ll +++ b/llvm/test/Other/new-pass-manager.ll @@ -298,6 +298,14 @@ ; CHECK-DT: Running analysis: DominatorTreeAnalysis ; CHECK-DT: Finished pass manager +; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \ +; RUN: -passes='require<aa>' \ +; RUN: | FileCheck %s --check-prefix=CHECK-AA +; CHECK-AA: Starting pass manager +; CHECK-AA: Running pass: RequireAnalysisPass +; CHECK-AA: Running analysis: AAManager +; CHECK-AA: Finished pass manager + define void @foo() { ret void } |

