diff options
Diffstat (limited to 'unittests/IR/DominatorTreeTest.cpp')
-rw-r--r-- | unittests/IR/DominatorTreeTest.cpp | 10 |
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 { |