diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2017-01-10 02:50:47 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2017-01-10 02:50:47 +0000 |
commit | 0668cd2c95882b0d665a5611348a8ed35d4f6ed0 (patch) | |
tree | c9c30f673b582b5894604931e4a279eb9d3abee2 /llvm/unittests/IR/DominatorTreeTest.cpp | |
parent | f8f909f848e7373dfa9dfcb99336bffb023aaa07 (diff) | |
download | bcm5719-llvm-0668cd2c95882b0d665a5611348a8ed35d4f6ed0.tar.gz bcm5719-llvm-0668cd2c95882b0d665a5611348a8ed35d4f6ed0.zip |
[StructurizeCfg] Update dominator info.
In some cases StructurizeCfg updates root node, but dominator info
remains unchanges, it causes crash when expensive checks are enabled.
To cope with this problem a new method was added to DominatorTreeBase
that allows adding new root nodes, it is called in StructurizeCfg to
put dominator tree in sync.
This change fixes PR27488.
Differential Revision: https://reviews.llvm.org/D28114
llvm-svn: 291530
Diffstat (limited to 'llvm/unittests/IR/DominatorTreeTest.cpp')
-rw-r--r-- | llvm/unittests/IR/DominatorTreeTest.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/unittests/IR/DominatorTreeTest.cpp b/llvm/unittests/IR/DominatorTreeTest.cpp index 6c49deb32d9..ae9c2684212 100644 --- a/llvm/unittests/IR/DominatorTreeTest.cpp +++ b/llvm/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 { |