Skip to content

Commit 451d82a

Browse files
committed
!fixup address comments, thanks
1 parent c0bf19d commit 451d82a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,36 +1085,36 @@ void VPlanTransforms::simplifyRecipes(VPlan &Plan, Type &CanonicalIVTy) {
10851085
}
10861086
}
10871087

1088-
static void convertToUniformRecipes(VPlan &Plan) {
1088+
static void narrowToSingleScalarRecipes(VPlan &Plan) {
10891089
if (Plan.hasScalarVFOnly())
10901090
return;
10911091

10921092
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
10931093
vp_depth_first_shallow(Plan.getVectorLoopRegion()->getEntry()))) {
10941094
for (VPRecipeBase &R : make_early_inc_range(reverse(*VPBB))) {
1095-
// Try to narrow wide and replicating recipes to uniform recipes, based on
1096-
// VPlan analysis.
1095+
// Try to narrow wide and replicating recipes to single scalar recipes,
1096+
// based on VPlan analysis.
10971097
auto *RepR = dyn_cast<VPReplicateRecipe>(&R);
10981098
if (!RepR && !isa<VPWidenRecipe>(&R))
10991099
continue;
1100-
if (RepR && RepR->isUniform())
1100+
if (RepR && RepR->isSingleScalar())
11011101
continue;
11021102

11031103
auto *RepOrWidenR = cast<VPSingleDefRecipe>(&R);
1104-
// Skip recipes that aren't uniform and don't have only their scalar
1105-
// results used. In the latter case, we would introduce extra broadcasts.
1106-
if (!vputils::isUniformAfterVectorization(RepOrWidenR) ||
1104+
// Skip recipes that aren't single scalars and don't have only their
1105+
// scalar results used. In the latter case, we would introduce extra
1106+
// broadcasts.
1107+
if (!vputils::isSingleScalar(RepOrWidenR) ||
11071108
any_of(RepOrWidenR->users(), [RepOrWidenR](VPUser *U) {
11081109
return !U->usesScalars(RepOrWidenR);
11091110
}))
11101111
continue;
11111112

1112-
auto *Clone =
1113-
new VPReplicateRecipe(RepOrWidenR->getUnderlyingInstr(),
1114-
RepOrWidenR->operands(), /*IsUniform*/ true);
1113+
auto *Clone = new VPReplicateRecipe(RepOrWidenR->getUnderlyingInstr(),
1114+
RepOrWidenR->operands(),
1115+
true /*IsSingleScalar*/);
11151116
Clone->insertBefore(RepOrWidenR);
11161117
RepOrWidenR->replaceAllUsesWith(Clone);
1117-
RepOrWidenR->eraseFromParent();
11181118
}
11191119
}
11201120
}
@@ -1813,7 +1813,7 @@ void VPlanTransforms::optimize(VPlan &Plan) {
18131813
runPass(simplifyRecipes, Plan, *Plan.getCanonicalIV()->getScalarType());
18141814
runPass(simplifyBlends, Plan);
18151815
runPass(removeDeadRecipes, Plan);
1816-
runPass(convertToUniformRecipes, Plan);
1816+
runPass(narrowToSingleScalarRecipes, Plan);
18171817
runPass(legalizeAndOptimizeInductions, Plan);
18181818
runPass(removeRedundantExpandSCEVRecipes, Plan);
18191819
runPass(simplifyRecipes, Plan, *Plan.getCanonicalIV()->getScalarType());

0 commit comments

Comments
 (0)