diff --git a/llvm/include/llvm/Support/GenericDomTreeConstruction.h b/llvm/include/llvm/Support/GenericDomTreeConstruction.h index d306ebe99bc1b..e504a0eddebaa 100644 --- a/llvm/include/llvm/Support/GenericDomTreeConstruction.h +++ b/llvm/include/llvm/Support/GenericDomTreeConstruction.h @@ -78,7 +78,7 @@ struct SemiNCAInfo { using UpdateT = typename DomTreeT::UpdateType; using UpdateKind = typename DomTreeT::UpdateKind; struct BatchUpdateInfo { - // Note: Updates inside PreViewCFG are aleady legalized. + // Note: Updates inside PreViewCFG are already legalized. BatchUpdateInfo(GraphDiffT &PreViewCFG, GraphDiffT *PostViewCFG = nullptr) : PreViewCFG(PreViewCFG), PostViewCFG(PostViewCFG), NumLegalized(PreViewCFG.getNumLegalizedUpdates()) {} @@ -430,7 +430,6 @@ struct SemiNCAInfo { // is unreachable. This is because we are still going to only visit each // unreachable node once, we may just visit it in two directions, // depending on how lucky we get. - SmallPtrSet ConnectToExitBlock; for (const NodePtr I : nodes(DT.Parent)) { if (SNCA.NodeToInfo.count(I) == 0) { LLVM_DEBUG(dbgs() @@ -457,7 +456,6 @@ struct SemiNCAInfo { LLVM_DEBUG(dbgs() << "\t\t\tFound a new furthest away node " << "(non-trivial root): " << BlockNamePrinter(FurthestAway) << "\n"); - ConnectToExitBlock.insert(FurthestAway); Roots.push_back(FurthestAway); LLVM_DEBUG(dbgs() << "\t\t\tPrev DFSNum: " << Num << ", new DFSNum: " << NewNum << "\n\t\t\tRemoving DFS info\n"); diff --git a/llvm/unittests/IR/DominatorTreeBatchUpdatesTest.cpp b/llvm/unittests/IR/DominatorTreeBatchUpdatesTest.cpp index a2d5805a9874e..08d41e46d4a83 100644 --- a/llvm/unittests/IR/DominatorTreeBatchUpdatesTest.cpp +++ b/llvm/unittests/IR/DominatorTreeBatchUpdatesTest.cpp @@ -6,12 +6,12 @@ // //===----------------------------------------------------------------------===// -#include #include "CFGBuilder.h" -#include "gtest/gtest.h" #include "llvm/Analysis/PostDominators.h" #include "llvm/IR/Dominators.h" #include "llvm/Support/GenericDomTreeConstruction.h" +#include "gtest/gtest.h" +#include #define DEBUG_TYPE "batch-update-tests" @@ -21,7 +21,6 @@ namespace { const auto CFGInsert = CFGBuilder::ActionKind::Insert; const auto CFGDelete = CFGBuilder::ActionKind::Delete; - using DomUpdate = DominatorTree::UpdateType; static_assert( std::is_same::value, @@ -62,9 +61,9 @@ TEST(DominatorTreeBatchUpdates, LegalizeDomUpdates) { LLVM_DEBUG(for (auto &U : Legalized) { U.dump(); dbgs() << ", "; }); LLVM_DEBUG(dbgs() << "\n"); EXPECT_EQ(Legalized.size(), 3UL); - EXPECT_NE(llvm::find(Legalized, DomUpdate{Insert, B, C}), Legalized.end()); - EXPECT_NE(llvm::find(Legalized, DomUpdate{Insert, B, D}), Legalized.end()); - EXPECT_NE(llvm::find(Legalized, DomUpdate{Delete, A, B}), Legalized.end()); + EXPECT_TRUE(llvm::is_contained(Legalized, DomUpdate{Insert, B, C})); + EXPECT_TRUE(llvm::is_contained(Legalized, DomUpdate{Insert, B, D})); + EXPECT_TRUE(llvm::is_contained(Legalized, DomUpdate{Delete, A, B})); } TEST(DominatorTreeBatchUpdates, LegalizePostDomUpdates) { @@ -85,9 +84,9 @@ TEST(DominatorTreeBatchUpdates, LegalizePostDomUpdates) { LLVM_DEBUG(for (auto &U : Legalized) { U.dump(); dbgs() << ", "; }); LLVM_DEBUG(dbgs() << "\n"); EXPECT_EQ(Legalized.size(), 3UL); - EXPECT_NE(llvm::find(Legalized, DomUpdate{Insert, C, B}), Legalized.end()); - EXPECT_NE(llvm::find(Legalized, DomUpdate{Insert, D, B}), Legalized.end()); - EXPECT_NE(llvm::find(Legalized, DomUpdate{Delete, B, A}), Legalized.end()); + EXPECT_TRUE(llvm::is_contained(Legalized, DomUpdate{Insert, C, B})); + EXPECT_TRUE(llvm::is_contained(Legalized, DomUpdate{Insert, D, B})); + EXPECT_TRUE(llvm::is_contained(Legalized, DomUpdate{Delete, B, A})); } TEST(DominatorTreeBatchUpdates, SingleInsertion) {