summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJakub Kuderski <kubakuderski@gmail.com>2017-07-15 01:27:16 +0000
committerJakub Kuderski <kubakuderski@gmail.com>2017-07-15 01:27:16 +0000
commit663603490b4bc10f37276b8c0c8089473f77d8a4 (patch)
tree26ae8cdae74937784d790b4fc1df0d17ca7a06bc /llvm
parentda4c312634375db6ad9451934f41e2bf65cd222e (diff)
downloadbcm5719-llvm-663603490b4bc10f37276b8c0c8089473f77d8a4.tar.gz
bcm5719-llvm-663603490b4bc10f37276b8c0c8089473f77d8a4.zip
[Dominators] Fix reachable visitation and reenable a unit test
This fixes a minor bug in insertion to a reachable node that caused DominatorTree.InsertDeleteExhaustive flakiness. The patch also adds a new testcase for this exact failure. llvm-svn: 308074
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Support/GenericDomTreeConstruction.h2
-rw-r--r--llvm/unittests/IR/DominatorTreeTest.cpp28
2 files changed, 28 insertions, 2 deletions
diff --git a/llvm/include/llvm/Support/GenericDomTreeConstruction.h b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
index 220b777b883..4ac6b65dea8 100644
--- a/llvm/include/llvm/Support/GenericDomTreeConstruction.h
+++ b/llvm/include/llvm/Support/GenericDomTreeConstruction.h
@@ -410,7 +410,7 @@ struct SemiNCAInfo {
II.AffectedQueue.push_back(CurrentNode);
// Discover and collect affected successors of the current node.
- VisitInsertion(DT, CurrentNode, ToLevel, NCD, II);
+ VisitInsertion(DT, CurrentNode, CurrentNode->getLevel(), NCD, II);
}
// Finish by updating immediate dominators and levels.
diff --git a/llvm/unittests/IR/DominatorTreeTest.cpp b/llvm/unittests/IR/DominatorTreeTest.cpp
index ddb61464209..df1e2993dc8 100644
--- a/llvm/unittests/IR/DominatorTreeTest.cpp
+++ b/llvm/unittests/IR/DominatorTreeTest.cpp
@@ -364,6 +364,32 @@ TEST(DominatorTree, InsertReachable) {
}
}
+TEST(DominatorTree, InsertReachable2) {
+ CFGHolder Holder;
+ std::vector<CFGBuilder::Arc> Arcs = {
+ {"1", "2"}, {"2", "3"}, {"3", "4"}, {"4", "5"}, {"5", "6"}, {"5", "7"},
+ {"7", "5"}, {"2", "8"}, {"8", "11"}, {"11", "12"}, {"12", "10"},
+ {"10", "9"}, {"9", "10"}};
+
+ std::vector<CFGBuilder::Update> Updates = {{Insert, {"10", "7"}}};
+ CFGBuilder B(Holder.F, Arcs, Updates);
+ DominatorTree DT(*Holder.F);
+ EXPECT_TRUE(DT.verify());
+ PostDomTree PDT(*Holder.F);
+ EXPECT_TRUE(PDT.verify());
+
+ Optional<CFGBuilder::Update> LastUpdate = B.applyUpdate();
+ EXPECT_TRUE(LastUpdate);
+
+ EXPECT_EQ(LastUpdate->Action, Insert);
+ BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From);
+ BasicBlock *To = B.getOrAddBlock(LastUpdate->Edge.To);
+ DT.insertEdge(From, To);
+ EXPECT_TRUE(DT.verify());
+ PDT.insertEdge(From, To);
+ EXPECT_TRUE(PDT.verify());
+}
+
TEST(DominatorTree, InsertUnreachable) {
CFGHolder Holder;
std::vector<CFGBuilder::Arc> Arcs = {{"1", "2"}, {"2", "3"}, {"3", "4"},
@@ -538,7 +564,7 @@ TEST(DominatorTree, InsertDelete) {
}
}
-TEST(DominatorTree, DISABLED_InsertDeleteExhaustive) {
+TEST(DominatorTree, InsertDeleteExhaustive) {
std::vector<CFGBuilder::Arc> Arcs = {
{"1", "2"}, {"2", "3"}, {"3", "4"}, {"4", "5"}, {"5", "6"}, {"5", "7"},
{"3", "8"}, {"8", "9"}, {"9", "10"}, {"8", "11"}, {"11", "12"}};
OpenPOWER on IntegriCloud