[DomTree][NFC] Clean up nits in DomTree code

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D112482
This commit is contained in:
Jakub Kuderski 2021-10-25 16:04:42 -04:00
parent ca8105b76c
commit 763ae1d2c6
2 changed files with 9 additions and 12 deletions

View File

@ -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");

View File

@ -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) {