aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Analysis/LoopPassManagerTest.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2016-03-11 11:05:24 +0000
committerChandler Carruth <chandlerc@gmail.com>2016-03-11 11:05:24 +0000
commitb47f8010a95f461f995e30dc2b77391093183605 (patch)
tree49902b63ea6fa976481a52ca24f1797e3f60ed67 /llvm/unittests/Analysis/LoopPassManagerTest.cpp
parentf4cc1fc7e9d7df18176fc139b30f78c24ac0cc31 (diff)
downloadllvm-b47f8010a95f461f995e30dc2b77391093183605.zip
llvm-b47f8010a95f461f995e30dc2b77391093183605.tar.gz
llvm-b47f8010a95f461f995e30dc2b77391093183605.tar.bz2
[PM] Make the AnalysisManager parameter to run methods a reference.
This was originally a pointer to support pass managers which didn't use AnalysisManagers. However, that doesn't realistically come up much and the complexity of supporting it doesn't really make sense. In fact, *many* parts of the pass manager were just assuming the pointer was never null already. This at least makes it much more explicit and clear. llvm-svn: 263219
Diffstat (limited to 'llvm/unittests/Analysis/LoopPassManagerTest.cpp')
-rw-r--r--llvm/unittests/Analysis/LoopPassManagerTest.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/unittests/Analysis/LoopPassManagerTest.cpp b/llvm/unittests/Analysis/LoopPassManagerTest.cpp
index 9fb46cb..8a62049 100644
--- a/llvm/unittests/Analysis/LoopPassManagerTest.cpp
+++ b/llvm/unittests/Analysis/LoopPassManagerTest.cpp
@@ -42,7 +42,7 @@ public:
TestLoopAnalysis(int &Runs) : Runs(Runs) {}
/// \brief Run the analysis pass over the loop and return a result.
- Result run(Loop &L, AnalysisManager<Loop> *AM) {
+ Result run(Loop &L, AnalysisManager<Loop> &AM) {
++Runs;
int Count = 0;
@@ -65,16 +65,16 @@ public:
: VisitedLoops(VisitedLoops), AnalyzedBlockCount(AnalyzedBlockCount),
OnlyUseCachedResults(OnlyUseCachedResults) {}
- PreservedAnalyses run(Loop &L, AnalysisManager<Loop> *AM) {
+ PreservedAnalyses run(Loop &L, AnalysisManager<Loop> &AM) {
VisitedLoops.push_back(L.getName());
if (OnlyUseCachedResults) {
// Hack to force the use of the cached interface.
- if (auto *AR = AM->getCachedResult<TestLoopAnalysis>(L))
+ if (auto *AR = AM.getCachedResult<TestLoopAnalysis>(L))
AnalyzedBlockCount += AR->BlockCount;
} else {
// Typical path just runs the analysis as needed.
- auto &AR = AM->getResult<TestLoopAnalysis>(L);
+ auto &AR = AM.getResult<TestLoopAnalysis>(L);
AnalyzedBlockCount += AR.BlockCount;
}
@@ -91,7 +91,7 @@ class TestLoopInvalidatingPass {
public:
TestLoopInvalidatingPass(StringRef LoopName) : Name(LoopName) {}
- PreservedAnalyses run(Loop &L, AnalysisManager<Loop> *AM) {
+ PreservedAnalyses run(Loop &L, AnalysisManager<Loop> &AM) {
return L.getName() == Name ? PreservedAnalyses::none()
: PreservedAnalyses::all();
}
@@ -185,7 +185,7 @@ TEST_F(LoopPassManagerTest, Basic) {
}
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
- MPM.run(*M, &MAM);
+ MPM.run(*M, MAM);
StringRef ExpectedLoops[] = {"loop.0.0", "loop.0.1", "loop.0", "loop.g.0"};