Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 361ff3b

Browse files
chandlercBjörn Steinbrink
authored andcommitted
[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. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260836 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 4f2b179 commit 361ff3b

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

include/llvm/Analysis/AliasAnalysis.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,12 @@ class AAManager {
991991
public:
992992
typedef AAResults Result;
993993

994+
/// \brief Opaque, unique identifier for this analysis pass.
995+
static void *ID() { return (void *)&PassID; }
996+
997+
/// \brief Provide access to a name for this pass.
998+
static StringRef name() { return "AAManager"; }
999+
9941000
// This type hase value semantics. We have to spell these out because MSVC
9951001
// won't synthesize them.
9961002
AAManager() {}
@@ -1012,14 +1018,16 @@ class AAManager {
10121018
FunctionResultGetters.push_back(&getFunctionAAResultImpl<AnalysisT>);
10131019
}
10141020

1015-
Result run(Function &F, AnalysisManager<Function> &AM) {
1021+
Result run(Function &F, AnalysisManager<Function> *AM) {
10161022
Result R;
10171023
for (auto &Getter : FunctionResultGetters)
1018-
(*Getter)(F, AM, R);
1024+
(*Getter)(F, *AM, R);
10191025
return R;
10201026
}
10211027

10221028
private:
1029+
static char PassID;
1030+
10231031
SmallVector<void (*)(Function &F, AnalysisManager<Function> &AM,
10241032
AAResults &AAResults),
10251033
4> FunctionResultGetters;

lib/Analysis/AliasAnalysis.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ bool AAResults::canInstructionRangeModRef(const Instruction &I1,
390390
// Provide a definition for the root virtual destructor.
391391
AAResults::Concept::~Concept() {}
392392

393+
// Provide a definition for the static object used to identify passes.
394+
char AAManager::PassID;
395+
393396
namespace {
394397
/// A wrapper pass for external alias analyses. This just squirrels away the
395398
/// callback used to run any analyses and register their results.

lib/Passes/PassBuilder.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
//===----------------------------------------------------------------------===//
1717

1818
#include "llvm/Passes/PassBuilder.h"
19+
#include "llvm/Analysis/AliasAnalysis.h"
1920
#include "llvm/Analysis/AssumptionCache.h"
2021
#include "llvm/Analysis/CGSCCPassManager.h"
2122
#include "llvm/Analysis/LazyCallGraph.h"

lib/Passes/PassRegistry.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass())
5353
#ifndef FUNCTION_ANALYSIS
5454
#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
5555
#endif
56+
FUNCTION_ANALYSIS("aa", AAManager())
5657
FUNCTION_ANALYSIS("assumptions", AssumptionAnalysis())
5758
FUNCTION_ANALYSIS("domtree", DominatorTreeAnalysis())
5859
FUNCTION_ANALYSIS("loops", LoopAnalysis())

test/Other/new-pass-manager.ll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@
298298
; CHECK-DT: Running analysis: DominatorTreeAnalysis
299299
; CHECK-DT: Finished pass manager
300300

301+
; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
302+
; RUN: -passes='require<aa>' \
303+
; RUN: | FileCheck %s --check-prefix=CHECK-AA
304+
; CHECK-AA: Starting pass manager
305+
; CHECK-AA: Running pass: RequireAnalysisPass
306+
; CHECK-AA: Running analysis: AAManager
307+
; CHECK-AA: Finished pass manager
308+
301309
define void @foo() {
302310
ret void
303311
}

0 commit comments

Comments
 (0)