Skip to content

Commit 3d589a9

Browse files
authored
[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 bdada75 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 #160449
1 parent ff11b93 commit 3d589a9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

llvm/unittests/Transforms/Vectorize/VPlanTest.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,20 @@ TEST_F(VPBasicBlockTest, reassociateBlocks) {
704704
}
705705
}
706706

707+
TEST_F(VPBasicBlockTest, splitAtEnd) {
708+
VPlan &Plan = getPlan();
709+
VPInstruction *VPI = new VPInstruction(0, {});
710+
VPBasicBlock *VPBB = Plan.createVPBasicBlock("VPBB1", VPI);
711+
VPBlockUtils::connectBlocks(Plan.getEntry(), VPBB);
712+
VPBlockUtils::connectBlocks(VPBB, Plan.getScalarHeader());
713+
VPBB->splitAt(VPBB->end());
714+
EXPECT_EQ(VPBB->size(), 1u);
715+
EXPECT_EQ(&VPBB->front(), VPI);
716+
auto *Split = cast<VPBasicBlock>(VPBB->getSingleSuccessor());
717+
EXPECT_TRUE(Split->empty());
718+
EXPECT_EQ(Split->getSingleSuccessor(), Plan.getScalarHeader());
719+
}
720+
707721
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
708722
TEST_F(VPBasicBlockTest, print) {
709723
VPInstruction *TC = new VPInstruction(Instruction::PHI, {});

0 commit comments

Comments
 (0)