Skip to content

Commit d8ca632

Browse files
committed
[VPlan] Address review
1 parent b9492cc commit d8ca632

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,19 +1421,23 @@ static void narrowToSingleScalarRecipes(VPlan &Plan) {
14211421
if (!vputils::isSingleScalar(RepOrWidenR) ||
14221422
!all_of(RepOrWidenR->users(), [RepOrWidenR](const VPUser *U) {
14231423
if (auto *Store = dyn_cast<VPWidenStoreRecipe>(U)) {
1424-
// The assert must hold as we checked the RepOrWidenR operand
1425-
// against vputils::isSingleScalar.
1424+
// VPWidenStore doesn't have users, and stores are always
1425+
// profitable to widen: hence, permitting single-scalar stored
1426+
// values is an important leaf condition. The assert must hold as
1427+
// we checked the RepOrWidenR operand against
1428+
// vputils::isSingleScalar.
14261429
assert(RepOrWidenR == Store->getAddr() ||
14271430
vputils::isSingleScalar(Store->getStoredValue()));
14281431
return true;
14291432
}
14301433

1431-
if (auto *VPI = dyn_cast<VPInstruction>(U))
1432-
if (VPI->isSingleScalar() ||
1433-
VPI->getOpcode() == VPInstruction::ExtractLastElement ||
1434-
VPI->getOpcode() == VPInstruction::ExtractLastLanePerPart ||
1435-
VPI->getOpcode() == VPInstruction::ExtractPenultimateElement)
1434+
if (auto *VPI = dyn_cast<VPInstruction>(U)) {
1435+
unsigned Opcode = VPI->getOpcode();
1436+
if (Opcode == VPInstruction::ExtractLastElement ||
1437+
Opcode == VPInstruction::ExtractLastLanePerPart ||
1438+
Opcode == VPInstruction::ExtractPenultimateElement)
14361439
return true;
1440+
}
14371441

14381442
return U->usesScalars(RepOrWidenR);
14391443
}))

0 commit comments

Comments
 (0)