[llvm] 6910aec - [VPlan] Don't use VPlan ctor taking trip count in most unit tests (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 18 11:57:45 PST 2024
Author: Florian Hahn
Date: 2024-12-18T19:57:09Z
New Revision: 6910aec097125317d33ade727d09db837be58d5f
URL: https://github.com/llvm/llvm-project/commit/6910aec097125317d33ade727d09db837be58d5f
DIFF: https://github.com/llvm/llvm-project/commit/6910aec097125317d33ade727d09db837be58d5f.diff
LOG: [VPlan] Don't use VPlan ctor taking trip count in most unit tests (NFC).
Update tests to use constructor not passing a trip count VPValue. The
tests don't need that and are simpler as a result.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/unittests/Transforms/Vectorize/VPDomTreeTest.cpp
llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
llvm/unittests/Transforms/Vectorize/VPlanVerifierTest.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index d26995883cb905..a3187eb45682ea 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -3813,13 +3813,6 @@ class VPlan {
DenseMap<const SCEV *, VPValue *> SCEVToExpansion;
public:
- /// Construct a VPlan with \p Entry entering the plan, trip count \p TC and
- /// with \p ScalarHeader wrapping the original header of the scalar loop.
- VPlan(VPBasicBlock *Entry, VPValue *TC, VPIRBasicBlock *ScalarHeader)
- : VPlan(Entry, ScalarHeader) {
- TripCount = TC;
- }
-
/// Construct a VPlan with \p Entry to the plan and with \p ScalarHeader
/// wrapping the original header of the scalar loop.
VPlan(VPBasicBlock *Entry, VPIRBasicBlock *ScalarHeader)
@@ -3829,6 +3822,13 @@ class VPlan {
"scalar header must be a leaf node");
}
+ /// Construct a VPlan with \p Entry entering the plan, trip count \p TC and
+ /// with \p ScalarHeader wrapping the original header of the scalar loop.
+ VPlan(VPBasicBlock *Entry, VPValue *TC, VPIRBasicBlock *ScalarHeader)
+ : VPlan(Entry, ScalarHeader) {
+ TripCount = TC;
+ }
+
~VPlan();
void setEntry(VPBasicBlock *VPBB) {
diff --git a/llvm/unittests/Transforms/Vectorize/VPDomTreeTest.cpp b/llvm/unittests/Transforms/Vectorize/VPDomTreeTest.cpp
index 55cbe83b85c62d..847cca7714effc 100644
--- a/llvm/unittests/Transforms/Vectorize/VPDomTreeTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPDomTreeTest.cpp
@@ -40,13 +40,12 @@ TEST(VPDominatorTreeTest, DominanceNoRegionsTest) {
VPBlockUtils::connectBlocks(VPBB2, VPBB4);
VPBlockUtils::connectBlocks(VPBB3, VPBB4);
- auto TC = std::make_unique<VPValue>();
LLVMContext C;
auto *ScalarHeader = BasicBlock::Create(C, "");
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(R1, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB0);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
VPDominatorTree VPDT;
VPDT.recalculate(Plan);
@@ -123,11 +122,10 @@ TEST(VPDominatorTreeTest, DominanceRegionsTest) {
VPBlockUtils::connectBlocks(R2BB1, R2BB2);
VPBlockUtils::connectBlocks(R1, R2);
- auto TC = std::make_unique<VPValue>();
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(R2, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB0);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
VPDominatorTree VPDT;
VPDT.recalculate(Plan);
@@ -206,11 +204,10 @@ TEST(VPDominatorTreeTest, DominanceRegionsTest) {
VPBasicBlock *VPBB2 = new VPBasicBlock("VPBB2");
VPBlockUtils::connectBlocks(R1, VPBB2);
- auto TC = std::make_unique<VPValue>();
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(VPBB2, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
VPDominatorTree VPDT;
VPDT.recalculate(Plan);
diff --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
index 97a1f8150beff2..6402d6f212660f 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
@@ -257,11 +257,10 @@ TEST(VPBasicBlockTest, getPlan) {
VPBlockUtils::connectBlocks(VPBB2, VPBB4);
VPBlockUtils::connectBlocks(VPBB3, VPBB4);
- auto TC = std::make_unique<VPValue>();
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(VPBB4, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
EXPECT_EQ(&Plan, VPBB1->getPlan());
EXPECT_EQ(&Plan, VPBB2->getPlan());
@@ -280,11 +279,10 @@ TEST(VPBasicBlockTest, getPlan) {
VPBasicBlock *VPBB1 = new VPBasicBlock();
VPBlockUtils::connectBlocks(VPBB1, R1);
- auto TC = std::make_unique<VPValue>();
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(R1, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
EXPECT_EQ(&Plan, VPBB1->getPlan());
EXPECT_EQ(&Plan, R1->getPlan());
@@ -313,11 +311,10 @@ TEST(VPBasicBlockTest, getPlan) {
VPBlockUtils::connectBlocks(R1, VPBB2);
VPBlockUtils::connectBlocks(R2, VPBB2);
- auto TC = std::make_unique<VPValue>();
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(R2, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
EXPECT_EQ(&Plan, VPBB1->getPlan());
EXPECT_EQ(&Plan, R1->getPlan());
@@ -360,11 +357,10 @@ TEST(VPBasicBlockTest, TraversingIteratorTest) {
EXPECT_EQ(VPBB2, FromIterator[1]);
// Use Plan to properly clean up created blocks.
- auto TC = std::make_unique<VPValue>();
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(VPBB4, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
}
{
@@ -463,11 +459,10 @@ TEST(VPBasicBlockTest, TraversingIteratorTest) {
EXPECT_EQ(R1, FromIterator[7]);
// Use Plan to properly clean up created blocks.
- auto TC = std::make_unique<VPValue>();
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(R2, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB0);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
}
{
@@ -549,11 +544,10 @@ TEST(VPBasicBlockTest, TraversingIteratorTest) {
EXPECT_EQ(VPBB1, FromIterator[9]);
// Use Plan to properly clean up created blocks.
- auto TC = std::make_unique<VPValue>();
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(VPBB2, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
}
{
@@ -600,11 +594,10 @@ TEST(VPBasicBlockTest, TraversingIteratorTest) {
EXPECT_EQ(VPBB1, FromIterator[4]);
// Use Plan to properly clean up created blocks.
- auto TC = std::make_unique<VPValue>();
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(R1, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
}
{
@@ -695,11 +688,10 @@ TEST(VPBasicBlockTest, TraversingIteratorTest) {
EXPECT_EQ(VPBB1, FromIterator[3]);
// Use Plan to properly clean up created blocks.
- auto TC = std::make_unique<VPValue>();
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(VPBB2, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
}
delete ScalarHeader;
}
diff --git a/llvm/unittests/Transforms/Vectorize/VPlanVerifierTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanVerifierTest.cpp
index 570d202f738c05..6448153de7821c 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanVerifierTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanVerifierTest.cpp
@@ -24,7 +24,6 @@ TEST(VPVerifierTest, VPInstructionUseBeforeDefSameBB) {
VPBB1->appendRecipe(UseI);
VPBB1->appendRecipe(DefI);
- auto TC = std::make_unique<VPValue>();
VPBasicBlock *VPBB2 = new VPBasicBlock();
VPRegionBlock *R1 = new VPRegionBlock(VPBB2, VPBB2, "R1");
VPBlockUtils::connectBlocks(VPBB1, R1);
@@ -34,7 +33,7 @@ TEST(VPVerifierTest, VPInstructionUseBeforeDefSameBB) {
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(R1, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
#if GTEST_HAS_STREAM_REDIRECTION
::testing::internal::CaptureStderr();
@@ -66,13 +65,12 @@ TEST(VPVerifierTest, VPInstructionUseBeforeDefDifferentBB) {
VPRegionBlock *R1 = new VPRegionBlock(VPBB2, VPBB2, "R1");
VPBlockUtils::connectBlocks(VPBB1, R1);
- auto TC = std::make_unique<VPValue>();
LLVMContext C;
auto *ScalarHeader = BasicBlock::Create(C, "");
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(R1, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
#if GTEST_HAS_STREAM_REDIRECTION
::testing::internal::CaptureStderr();
@@ -115,12 +113,11 @@ TEST(VPVerifierTest, VPBlendUseBeforeDefDifferentBB) {
VPBlockUtils::connectBlocks(VPBB1, R1);
VPBB3->setParent(R1);
- auto TC = std::make_unique<VPValue>();
auto *ScalarHeader = BasicBlock::Create(C, "");
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(R1, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
#if GTEST_HAS_STREAM_REDIRECTION
::testing::internal::CaptureStderr();
@@ -156,13 +153,12 @@ TEST(VPVerifierTest, DuplicateSuccessorsOutsideRegion) {
VPBlockUtils::connectBlocks(VPBB1, R1);
VPBlockUtils::connectBlocks(VPBB1, R1);
- auto TC = std::make_unique<VPValue>();
LLVMContext C;
auto *ScalarHeader = BasicBlock::Create(C, "");
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(R1, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
#if GTEST_HAS_STREAM_REDIRECTION
::testing::internal::CaptureStderr();
@@ -199,13 +195,12 @@ TEST(VPVerifierTest, DuplicateSuccessorsInsideRegion) {
VPBlockUtils::connectBlocks(VPBB1, R1);
VPBB3->setParent(R1);
- auto TC = std::make_unique<VPValue>();
LLVMContext C;
auto *ScalarHeader = BasicBlock::Create(C, "");
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(R1, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
#if GTEST_HAS_STREAM_REDIRECTION
::testing::internal::CaptureStderr();
@@ -233,13 +228,12 @@ TEST(VPVerifierTest, BlockOutsideRegionWithParent) {
VPRegionBlock *R1 = new VPRegionBlock(VPBB2, VPBB2, "R1");
VPBlockUtils::connectBlocks(VPBB1, R1);
- auto TC = std::make_unique<VPValue>();
LLVMContext C;
auto *ScalarHeader = BasicBlock::Create(C, "");
VPIRBasicBlock *ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
VPBlockUtils::connectBlocks(R1, ScalarHeaderVPBB);
VPBlockUtils::connectBlocks(VPPH, VPBB1);
- VPlan Plan(VPPH, &*TC, ScalarHeaderVPBB);
+ VPlan Plan(VPPH, ScalarHeaderVPBB);
VPBB1->setParent(R1);
#if GTEST_HAS_STREAM_REDIRECTION
More information about the llvm-commits
mailing list