[llvm] 3d589a9 - [VPlan] Add splitAt unit test. NFC (#164636)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 6 07:20:53 PST 2025
Author: Luke Lau
Date: 2025-11-06T15:20:48Z
New Revision: 3d589a93efed59349a432aef757abfaaf12f59b9
URL: https://github.com/llvm/llvm-project/commit/3d589a93efed59349a432aef757abfaaf12f59b9
DIFF: https://github.com/llvm/llvm-project/commit/3d589a93efed59349a432aef757abfaaf12f59b9.diff
LOG: [VPlan] Add splitAt unit test. NFC (#164636)
@sink_replicate_region_4_requires_split_at_end_of_block was originally
added to ensure splitting at the end of a block wouldn't crash, see
bdada7546e6b4a189a22c7ba9ce2d1b507b9c22e
However it looks like we're now no longer testing this because conv
isn't at the end of the block anymore.
This moves it into a unit test instead. Discovered when working on
https://github.com/llvm/llvm-project/pull/160449
Added:
Modified:
llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
index c1791dfa5b761..c256eae5dcdc2 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
@@ -704,6 +704,20 @@ TEST_F(VPBasicBlockTest, reassociateBlocks) {
}
}
+TEST_F(VPBasicBlockTest, splitAtEnd) {
+ VPlan &Plan = getPlan();
+ VPInstruction *VPI = new VPInstruction(0, {});
+ VPBasicBlock *VPBB = Plan.createVPBasicBlock("VPBB1", VPI);
+ VPBlockUtils::connectBlocks(Plan.getEntry(), VPBB);
+ VPBlockUtils::connectBlocks(VPBB, Plan.getScalarHeader());
+ VPBB->splitAt(VPBB->end());
+ EXPECT_EQ(VPBB->size(), 1u);
+ EXPECT_EQ(&VPBB->front(), VPI);
+ auto *Split = cast<VPBasicBlock>(VPBB->getSingleSuccessor());
+ EXPECT_TRUE(Split->empty());
+ EXPECT_EQ(Split->getSingleSuccessor(), Plan.getScalarHeader());
+}
+
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
TEST_F(VPBasicBlockTest, print) {
VPInstruction *TC = new VPInstruction(Instruction::PHI, {});
More information about the llvm-commits
mailing list