Skip to content

Commit 312997f

Browse files
artagnonLukacma
authored andcommitted
[VPlan] Improve code using drop_begin, append_range (NFC) (llvm#163934)
1 parent fabb6e3 commit 312997f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ bool VPlanTransforms::tryToConvertVPInstructionsToVPRecipes(
106106
return false;
107107
NewRecipe = new VPWidenIntrinsicRecipe(
108108
*CI, getVectorIntrinsicIDForCall(CI, &TLI),
109-
{Ingredient.op_begin(), Ingredient.op_end() - 1}, CI->getType(),
109+
drop_end(Ingredient.operands()), CI->getType(),
110110
CI->getDebugLoc());
111111
} else if (SelectInst *SI = dyn_cast<SelectInst>(Inst)) {
112112
NewRecipe = new VPWidenSelectRecipe(*SI, Ingredient.operands());
@@ -356,8 +356,7 @@ static VPRegionBlock *createReplicateRegion(VPReplicateRecipe *PredRecipe,
356356
// Replace predicated replicate recipe with a replicate recipe without a
357357
// mask but in the replicate region.
358358
auto *RecipeWithoutMask = new VPReplicateRecipe(
359-
PredRecipe->getUnderlyingInstr(),
360-
make_range(PredRecipe->op_begin(), std::prev(PredRecipe->op_end())),
359+
PredRecipe->getUnderlyingInstr(), drop_end(PredRecipe->operands()),
361360
PredRecipe->isSingleScalar(), nullptr /*Mask*/, *PredRecipe);
362361
auto *Pred =
363362
Plan.createVPBasicBlock(Twine(RegionName) + ".if", RecipeWithoutMask);
@@ -939,7 +938,7 @@ static void recursivelyDeleteDeadRecipes(VPValue *V) {
939938
continue;
940939
if (!isDeadRecipe(*R))
941940
continue;
942-
WorkList.append(R->op_begin(), R->op_end());
941+
append_range(WorkList, R->operands());
943942
R->eraseFromParent();
944943
}
945944
}

0 commit comments

Comments
 (0)