[llvm] 763ae1d - [DomTree][NFC] Clean up nits in DomTree code
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 25 13:06:02 PDT 2021
Author: Jakub Kuderski
Date: 2021-10-25T16:05:34-04:00
New Revision: 763ae1d2c6a4287b165cb669b13d5fc84ad6e92b
URL: https://github.com/llvm/llvm-project/commit/763ae1d2c6a4287b165cb669b13d5fc84ad6e92b
DIFF: https://github.com/llvm/llvm-project/commit/763ae1d2c6a4287b165cb669b13d5fc84ad6e92b.diff
LOG: [DomTree][NFC] Clean up nits in DomTree code
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D112482
Added:
Modified:
llvm/include/llvm/Support/GenericDomTreeConstruction.h
llvm/unittests/IR/DominatorTreeBatchUpdatesTest.cpp
Removed:
################################################################################
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<NodePtr, 4> 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 <random>
#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 <random>
#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<DomUpdate, PostDominatorTree::UpdateType>::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) {
More information about the llvm-commits
mailing list