Skip to content

Commit ac83d60

Browse files
committed
[VPlan] Address review
1 parent 90215ac commit ac83d60

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

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

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

0 commit comments

Comments
 (0)