[llvm] r260836 - [PM/AA] Actually wire the AAManager I built for the new pass manager
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 13 15:32:00 PST 2016
Author: chandlerc
Date: Sat Feb 13 17:32:00 2016
New Revision: 260836
URL: http://llvm.org/viewvc/llvm-project?rev=260836&view=rev
Log:
[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. =]
Modified:
llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
llvm/trunk/lib/Analysis/AliasAnalysis.cpp
llvm/trunk/lib/Passes/PassBuilder.cpp
llvm/trunk/lib/Passes/PassRegistry.def
llvm/trunk/test/Other/new-pass-manager.ll
Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasAnalysis.h?rev=260836&r1=260835&r2=260836&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasAnalysis.h Sat Feb 13 17:32:00 2016
@@ -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;
Modified: llvm/trunk/lib/Analysis/AliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysis.cpp?rev=260836&r1=260835&r2=260836&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysis.cpp Sat Feb 13 17:32:00 2016
@@ -390,6 +390,9 @@ bool AAResults::canInstructionRangeModRe
// 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.
Modified: llvm/trunk/lib/Passes/PassBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=260836&r1=260835&r2=260836&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp (original)
+++ llvm/trunk/lib/Passes/PassBuilder.cpp Sat Feb 13 17:32:00 2016
@@ -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"
Modified: llvm/trunk/lib/Passes/PassRegistry.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassRegistry.def?rev=260836&r1=260835&r2=260836&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassRegistry.def (original)
+++ llvm/trunk/lib/Passes/PassRegistry.def Sat Feb 13 17:32:00 2016
@@ -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())
Modified: llvm/trunk/test/Other/new-pass-manager.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/new-pass-manager.ll?rev=260836&r1=260835&r2=260836&view=diff
==============================================================================
--- llvm/trunk/test/Other/new-pass-manager.ll (original)
+++ llvm/trunk/test/Other/new-pass-manager.ll Sat Feb 13 17:32:00 2016
@@ -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
}
More information about the llvm-commits
mailing list