llvm.org GIT mirror llvm / 37b0ef0
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308074 91177308-0d34-0410-b5e6-96231b3b80d8 Jakub Kuderski 2 years ago
2 changed file(s) with 28 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
409409 II.AffectedQueue.push_back(CurrentNode);
410410
411411 // Discover and collect affected successors of the current node.
412 VisitInsertion(DT, CurrentNode, ToLevel, NCD, II);
412 VisitInsertion(DT, CurrentNode, CurrentNode->getLevel(), NCD, II);
413413 }
414414
415415 // Finish by updating immediate dominators and levels.
363363 }
364364 }
365365
366 TEST(DominatorTree, InsertReachable2) {
367 CFGHolder Holder;
368 std::vector Arcs = {
369 {"1", "2"}, {"2", "3"}, {"3", "4"}, {"4", "5"}, {"5", "6"}, {"5", "7"},
370 {"7", "5"}, {"2", "8"}, {"8", "11"}, {"11", "12"}, {"12", "10"},
371 {"10", "9"}, {"9", "10"}};
372
373 std::vector Updates = {{Insert, {"10", "7"}}};
374 CFGBuilder B(Holder.F, Arcs, Updates);
375 DominatorTree DT(*Holder.F);
376 EXPECT_TRUE(DT.verify());
377 PostDomTree PDT(*Holder.F);
378 EXPECT_TRUE(PDT.verify());
379
380 Optional LastUpdate = B.applyUpdate();
381 EXPECT_TRUE(LastUpdate);
382
383 EXPECT_EQ(LastUpdate->Action, Insert);
384 BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From);
385 BasicBlock *To = B.getOrAddBlock(LastUpdate->Edge.To);
386 DT.insertEdge(From, To);
387 EXPECT_TRUE(DT.verify());
388 PDT.insertEdge(From, To);
389 EXPECT_TRUE(PDT.verify());
390 }
391
366392 TEST(DominatorTree, InsertUnreachable) {
367393 CFGHolder Holder;
368394 std::vector Arcs = {{"1", "2"}, {"2", "3"}, {"3", "4"},
537563 }
538564 }
539565
540 TEST(DominatorTree, DISABLED_InsertDeleteExhaustive) {
566 TEST(DominatorTree, InsertDeleteExhaustive) {
541567 std::vector Arcs = {
542568 {"1", "2"}, {"2", "3"}, {"3", "4"}, {"4", "5"}, {"5", "6"}, {"5", "7"},
543569 {"3", "8"}, {"8", "9"}, {"9", "10"}, {"8", "11"}, {"11", "12"}};