Skip to content

Commit 13e49ef

Browse files
committed
Use Succ->getEntryBasicBlock()->phis(), add comments
1 parent 8cfe2f2 commit 13e49ef

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

llvm/lib/Transforms/Vectorize/VPlanUtils.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,7 @@ class VPBlockUtils {
173173
Succ->replacePredecessor(Old, New);
174174

175175
// Replace any references to Old in widened phi incoming blocks.
176-
while (auto *Region = dyn_cast<VPRegionBlock>(Succ))
177-
Succ = Region->getEntry();
178-
179-
for (auto &R : *cast<VPBasicBlock>(Succ))
176+
for (auto &R : Succ->getEntryBasicBlock()->phis())
180177
if (auto *WidenPhiR = dyn_cast<VPWidenPHIRecipe>(&R))
181178
for (unsigned I = 0; I < WidenPhiR->getNumOperands(); I++)
182179
if (WidenPhiR->getIncomingBlock(I) == Old)

llvm/unittests/Transforms/Vectorize/VPlanTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,8 @@ TEST_F(VPBasicBlockTest, TraversingIteratorTest) {
661661

662662
TEST_F(VPBasicBlockTest, reassociateBlocks) {
663663
{
664+
// Ensure that when we reassociate a basic block, we make sure to update any
665+
// references to it in VPWidenPHIRecipes' incoming blocks.
664666
VPlan &Plan = getPlan();
665667
VPBasicBlock *VPBB1 = Plan.createVPBasicBlock("VPBB1");
666668
VPBasicBlock *VPBB2 = Plan.createVPBasicBlock("VPBB2");
@@ -679,6 +681,8 @@ TEST_F(VPBasicBlockTest, reassociateBlocks) {
679681
}
680682

681683
{
684+
// Ensure that we update VPWidenPHIRecipes that are nested inside a
685+
// VPRegionBlock.
682686
VPlan &Plan = getPlan();
683687
VPBasicBlock *VPBB1 = Plan.createVPBasicBlock("VPBB1");
684688
VPBasicBlock *VPBB2 = Plan.createVPBasicBlock("VPBB2");

0 commit comments

Comments
 (0)