Skip to content

Commit

Permalink
[VPlan] Update unit tests to use getVectorLoopRegion (NFC).
Browse files Browse the repository at this point in the history
Use getVectorLoopRegion to retrieve the vector loop header instead of
relying on getting the successor of the entry block. This makes sure the
code still works correctly as more parts of the skeleton are modeled in
VPlan.
  • Loading branch information
fhahn committed Oct 24, 2024
1 parent a291f00 commit 0558fe3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ TEST_F(VPlanHCFGTest, testBuildHCFGInnerLoop) {

// Check that the region following the preheader is a single basic-block
// region (loop).
VPBasicBlock *VecBB = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *VecBB = Plan->getVectorLoopRegion()->getEntryBasicBlock();
EXPECT_EQ(8u, VecBB->size());
EXPECT_EQ(0u, VecBB->getNumPredecessors());
EXPECT_EQ(0u, VecBB->getNumSuccessors());
Expand Down Expand Up @@ -193,7 +193,7 @@ TEST_F(VPlanHCFGTest, testVPInstructionToVPRecipesInner) {

// Check that the region following the preheader is a single basic-block
// region (loop).
VPBasicBlock *VecBB = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *VecBB = Plan->getVectorLoopRegion()->getEntryBasicBlock();
EXPECT_EQ(8u, VecBB->size());
EXPECT_EQ(0u, VecBB->getNumPredecessors());
EXPECT_EQ(0u, VecBB->getNumSuccessors());
Expand Down
24 changes: 12 additions & 12 deletions llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ TEST_F(VPlanSlpTest, testSlpSimple_2) {

VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
VPBasicBlock *Body = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *Body = Plan->getVectorLoopRegion()->getEntryBasicBlock();

VPInstruction *Store1 = cast<VPInstruction>(&*std::next(Body->begin(), 12));
VPInstruction *Store2 = cast<VPInstruction>(&*std::next(Body->begin(), 14));
Expand Down Expand Up @@ -171,7 +171,7 @@ TEST_F(VPlanSlpTest, testSlpSimple_3) {

VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
VPBasicBlock *Body = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *Body = Plan->getVectorLoopRegion()->getEntryBasicBlock();

VPInstruction *Store1 = cast<VPInstruction>(&*std::next(Body->begin(), 12));
VPInstruction *Store2 = cast<VPInstruction>(&*std::next(Body->begin(), 14));
Expand Down Expand Up @@ -243,7 +243,7 @@ TEST_F(VPlanSlpTest, testSlpReuse_1) {

VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
VPBasicBlock *Body = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *Body = Plan->getVectorLoopRegion()->getEntryBasicBlock();

VPInstruction *Store1 = cast<VPInstruction>(&*std::next(Body->begin(), 8));
VPInstruction *Store2 = cast<VPInstruction>(&*std::next(Body->begin(), 10));
Expand Down Expand Up @@ -307,7 +307,7 @@ TEST_F(VPlanSlpTest, testSlpReuse_2) {

VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
VPBasicBlock *Body = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *Body = Plan->getVectorLoopRegion()->getEntryBasicBlock();

VPInstruction *Store1 = cast<VPInstruction>(&*std::next(Body->begin(), 5));
VPInstruction *Store2 = cast<VPInstruction>(&*std::next(Body->begin(), 10));
Expand Down Expand Up @@ -444,7 +444,7 @@ TEST_F(VPlanSlpTest, testSlpReorder_1) {

VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
VPBasicBlock *Body = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *Body = Plan->getVectorLoopRegion()->getEntryBasicBlock();

VPInstruction *Store1 = cast<VPInstruction>(&*std::next(Body->begin(), 24));
VPInstruction *Store2 = cast<VPInstruction>(&*std::next(Body->begin(), 26));
Expand Down Expand Up @@ -516,7 +516,7 @@ TEST_F(VPlanSlpTest, testSlpReorder_2) {

VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
VPBasicBlock *Body = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *Body = Plan->getVectorLoopRegion()->getEntryBasicBlock();

VPInstruction *Store1 = cast<VPInstruction>(&*std::next(Body->begin(), 24));
VPInstruction *Store2 = cast<VPInstruction>(&*std::next(Body->begin(), 26));
Expand Down Expand Up @@ -588,7 +588,7 @@ TEST_F(VPlanSlpTest, testSlpReorder_3) {

VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
VPBasicBlock *Body = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *Body = Plan->getVectorLoopRegion()->getEntryBasicBlock();

VPInstruction *Store1 = cast<VPInstruction>(&*std::next(Body->begin(), 24));
VPInstruction *Store2 = cast<VPInstruction>(&*std::next(Body->begin(), 26));
Expand Down Expand Up @@ -664,7 +664,7 @@ TEST_F(VPlanSlpTest, testSlpReorder_4) {

VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
VPBasicBlock *Body = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *Body = Plan->getVectorLoopRegion()->getEntryBasicBlock();

VPInstruction *Store1 = cast<VPInstruction>(&*std::next(Body->begin(), 24));
VPInstruction *Store2 = cast<VPInstruction>(&*std::next(Body->begin(), 26));
Expand Down Expand Up @@ -725,7 +725,7 @@ TEST_F(VPlanSlpTest, testInstrsInDifferentBBs) {

VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
VPBasicBlock *Body = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *Body = Plan->getVectorLoopRegion()->getEntryBasicBlock();
VPBasicBlock *BB2 = Body->getSingleSuccessor()->getEntryBasicBlock();

VPInstruction *Store1 = cast<VPInstruction>(&*std::next(BB2->begin(), 3));
Expand Down Expand Up @@ -788,7 +788,7 @@ TEST_F(VPlanSlpTest, testInstrsInDifferentBBs2) {

VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
VPBasicBlock *Body = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *Body = Plan->getVectorLoopRegion()->getEntryBasicBlock();
VPBasicBlock *BB2 = Body->getSingleSuccessor()->getEntryBasicBlock();

VPInstruction *Store1 = cast<VPInstruction>(&*std::next(BB2->begin(), 1));
Expand Down Expand Up @@ -848,7 +848,7 @@ TEST_F(VPlanSlpTest, testSlpAtomicLoad) {

VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
VPBasicBlock *Body = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *Body = Plan->getVectorLoopRegion()->getEntryBasicBlock();

VPInstruction *Store1 = cast<VPInstruction>(&*std::next(Body->begin(), 12));
VPInstruction *Store2 = cast<VPInstruction>(&*std::next(Body->begin(), 14));
Expand Down Expand Up @@ -907,7 +907,7 @@ TEST_F(VPlanSlpTest, testSlpAtomicStore) {

VPBlockBase *Entry = Plan->getEntry()->getEntryBasicBlock();
EXPECT_NE(nullptr, Entry->getSingleSuccessor());
VPBasicBlock *Body = Entry->getSingleSuccessor()->getEntryBasicBlock();
VPBasicBlock *Body = Plan->getVectorLoopRegion()->getEntryBasicBlock();

VPInstruction *Store1 = cast<VPInstruction>(&*std::next(Body->begin(), 12));
VPInstruction *Store2 = cast<VPInstruction>(&*std::next(Body->begin(), 14));
Expand Down

0 comments on commit 0558fe3

Please sign in to comment.