summaryrefslogtreecommitdiff
path: root/unittests/IR/DominatorTreeTest.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-14 15:37:50 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-14 15:37:50 +0000
commit581a6d8501ff5614297da837b81ed3b6956361ea (patch)
tree985ee91d0ca1d3e6506ac5ff7e37f5b67adfec09 /unittests/IR/DominatorTreeTest.cpp
parent909545a822eef491158f831688066f0ec2866938 (diff)
Diffstat (limited to 'unittests/IR/DominatorTreeTest.cpp')
-rw-r--r--unittests/IR/DominatorTreeTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/unittests/IR/DominatorTreeTest.cpp b/unittests/IR/DominatorTreeTest.cpp
index 6c49deb32d94e..ae9c2684212b8 100644
--- a/unittests/IR/DominatorTreeTest.cpp
+++ b/unittests/IR/DominatorTreeTest.cpp
@@ -203,6 +203,16 @@ namespace llvm {
EXPECT_EQ(DT->getNode(BB4)->getDFSNumIn(), 5UL);
EXPECT_EQ(DT->getNode(BB4)->getDFSNumOut(), 6UL);
+ // Change root node
+ DT->verifyDomTree();
+ BasicBlock *NewEntry = BasicBlock::Create(F.getContext(), "new_entry",
+ &F, BB0);
+ BranchInst::Create(BB0, NewEntry);
+ EXPECT_EQ(F.begin()->getName(), NewEntry->getName());
+ EXPECT_TRUE(&F.getEntryBlock() == NewEntry);
+ DT->setNewRoot(NewEntry);
+ DT->verifyDomTree();
+
return false;
}
void getAnalysisUsage(AnalysisUsage &AU) const override {