summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-01-13 13:07:17 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-01-13 13:07:17 +0000
commit7f2eff792a2e18758a25956abdac2440ee18dd7f (patch)
tree09911f13e262320405959f2fd63dc7c2294275fc /unittests
parentbb4954ddbfc9c1c3b2aa45b551bc02927ab65629 (diff)
downloadllvm-7f2eff792a2e18758a25956abdac2440ee18dd7f.tar.gz
llvm-7f2eff792a2e18758a25956abdac2440ee18dd7f.tar.bz2
llvm-7f2eff792a2e18758a25956abdac2440ee18dd7f.tar.xz
[PM] Split DominatorTree into a concrete analysis result object which
can be used by both the new pass manager and the old. This removes it from any of the virtual mess of the pass interfaces and lets it derive cleanly from the DominatorTreeBase<> template. In turn, tons of boilerplate interface can be nuked and it turns into a very straightforward extension of the base DominatorTree interface. The old analysis pass is now a simple wrapper. The names and style of this split should match the split between CallGraph and CallGraphWrapperPass. All of the users of DominatorTree have been updated to match using many of the same tricks as with CallGraph. The goal is that the common type remains the resulting DominatorTree rather than the pass. This will make subsequent work toward the new pass manager significantly easier. Also in numerous places things became cleaner because I switched from re-running the pass (!!! mid way through some other passes run!!!) to directly recomputing the domtree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199104 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Analysis/CFGTest.cpp8
-rw-r--r--unittests/IR/DominatorTreeTest.cpp7
2 files changed, 9 insertions, 6 deletions
diff --git a/unittests/Analysis/CFGTest.cpp b/unittests/Analysis/CFGTest.cpp
index 88c4b00e76..76514f4d89 100644
--- a/unittests/Analysis/CFGTest.cpp
+++ b/unittests/Analysis/CFGTest.cpp
@@ -78,14 +78,15 @@ protected:
"", &ID, 0, true, true);
PassRegistry::getPassRegistry()->registerPass(*PI, false);
initializeLoopInfoPass(*PassRegistry::getPassRegistry());
- initializeDominatorTreePass(*PassRegistry::getPassRegistry());
+ initializeDominatorTreeWrapperPassPass(
+ *PassRegistry::getPassRegistry());
return 0;
}
void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<LoopInfo>();
- AU.addRequired<DominatorTree>();
+ AU.addRequired<DominatorTreeWrapperPass>();
}
bool runOnFunction(Function &F) {
@@ -93,7 +94,8 @@ protected:
return false;
LoopInfo *LI = &getAnalysis<LoopInfo>();
- DominatorTree *DT = &getAnalysis<DominatorTree>();
+ DominatorTree *DT =
+ &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
EXPECT_EQ(isPotentiallyReachable(A, B, 0, 0), ExpectedResult);
EXPECT_EQ(isPotentiallyReachable(A, B, DT, 0), ExpectedResult);
EXPECT_EQ(isPotentiallyReachable(A, B, 0, LI), ExpectedResult);
diff --git a/unittests/IR/DominatorTreeTest.cpp b/unittests/IR/DominatorTreeTest.cpp
index afe5c73ca4..d10031cb41 100644
--- a/unittests/IR/DominatorTreeTest.cpp
+++ b/unittests/IR/DominatorTreeTest.cpp
@@ -26,7 +26,8 @@ namespace llvm {
struct DPass : public FunctionPass {
static char ID;
virtual bool runOnFunction(Function &F) {
- DominatorTree *DT = &getAnalysis<DominatorTree>();
+ DominatorTree *DT =
+ &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
PostDominatorTree *PDT = &getAnalysis<PostDominatorTree>();
Function::iterator FI = F.begin();
@@ -176,7 +177,7 @@ namespace llvm {
return false;
}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.addRequired<DominatorTree>();
+ AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<PostDominatorTree>();
}
DPass() : FunctionPass(ID) {
@@ -226,6 +227,6 @@ namespace llvm {
}
INITIALIZE_PASS_BEGIN(DPass, "dpass", "dpass", false, false)
-INITIALIZE_PASS_DEPENDENCY(DominatorTree)
+INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_DEPENDENCY(PostDominatorTree)
INITIALIZE_PASS_END(DPass, "dpass", "dpass", false, false)