Skip to content

Commit bdb299a

Browse files
committed
[VPlan] Simplify code in single scalar transform code (NFC).
Adjust code as suggested post-commit 3b7b95f. 3b7b95f#r160997427
1 parent a365abd commit bdb299a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,9 +1220,9 @@ static void narrowToSingleScalarRecipes(VPlan &Plan) {
12201220
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
12211221
vp_depth_first_shallow(Plan.getVectorLoopRegion()->getEntry()))) {
12221222
for (VPRecipeBase &R : make_early_inc_range(reverse(*VPBB))) {
1223-
auto *RepR = dyn_cast<VPReplicateRecipe>(&R);
1224-
if (!RepR && !isa<VPWidenRecipe, VPWidenSelectRecipe>(&R))
1223+
if (!isa<VPWidenRecipe, VPWidenSelectRecipe, VPReplicateRecipe>(&R))
12251224
continue;
1225+
auto *RepR = dyn_cast<VPReplicateRecipe>(&R);
12261226
if (RepR && (RepR->isSingleScalar() || RepR->isPredicated()))
12271227
continue;
12281228

llvm/lib/Transforms/Vectorize/VPlanUtils.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,13 @@ inline bool isSingleScalar(const VPValue *VPV) {
6969
return Rep->isSingleScalar() || (PreservesUniformity(Rep->getOpcode()) &&
7070
all_of(Rep->operands(), isSingleScalar));
7171
}
72-
if (isa<VPWidenGEPRecipe, VPDerivedIVRecipe, VPBlendRecipe>(VPV))
72+
if (isa<VPWidenGEPRecipe, VPDerivedIVRecipe, VPBlendRecipe,
73+
VPWidenSelectRecipe>(VPV))
7374
return all_of(VPV->getDefiningRecipe()->operands(), isSingleScalar);
7475
if (auto *WidenR = dyn_cast<VPWidenRecipe>(VPV)) {
7576
return PreservesUniformity(WidenR->getOpcode()) &&
7677
all_of(WidenR->operands(), isSingleScalar);
7778
}
78-
if (auto *WidenR = dyn_cast<VPWidenSelectRecipe>(VPV))
79-
return all_of(WidenR->operands(), isSingleScalar);
8079
if (auto *VPI = dyn_cast<VPInstruction>(VPV))
8180
return VPI->isSingleScalar() || VPI->isVectorToScalar() ||
8281
(PreservesUniformity(VPI->getOpcode()) &&

0 commit comments

Comments
 (0)