Skip to content

Commit b2b0fdf

Browse files
committed
[VPlan] Improve code in VPWidenCallRecipe (NFC)
Also rename arg_operands to args to match CallBase.
1 parent 29db305 commit b2b0fdf

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,8 +1488,8 @@ class VPWidenCallRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
14881488
~VPWidenCallRecipe() override = default;
14891489

14901490
VPWidenCallRecipe *clone() override {
1491-
return new VPWidenCallRecipe(getUnderlyingValue(), Variant,
1492-
{op_begin(), op_end()}, getDebugLoc());
1491+
return new VPWidenCallRecipe(getUnderlyingValue(), Variant, operands(),
1492+
getDebugLoc());
14931493
}
14941494

14951495
VP_CLASSOF_IMPL(VPDef::VPWidenCallSC)
@@ -1505,11 +1505,9 @@ class VPWidenCallRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15051505
return cast<Function>(getOperand(getNumOperands() - 1)->getLiveInIRValue());
15061506
}
15071507

1508-
operand_range arg_operands() {
1509-
return make_range(op_begin(), op_begin() + getNumOperands() - 1);
1510-
}
1511-
const_operand_range arg_operands() const {
1512-
return make_range(op_begin(), op_begin() + getNumOperands() - 1);
1508+
operand_range args() { return make_range(op_begin(), std::prev(op_end())); }
1509+
const_operand_range args() const {
1510+
return make_range(op_begin(), std::prev(op_end()));
15131511
}
15141512

15151513
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ void VPWidenCallRecipe::execute(VPTransformState &State) {
12351235
FunctionType *VFTy = Variant->getFunctionType();
12361236
// Add return type if intrinsic is overloaded on it.
12371237
SmallVector<Value *, 4> Args;
1238-
for (const auto &I : enumerate(arg_operands())) {
1238+
for (const auto &I : enumerate(args())) {
12391239
Value *Arg;
12401240
// Some vectorized function variants may also take a scalar argument,
12411241
// e.g. linear parameters for pointers. This needs to be the scalar value
@@ -1284,7 +1284,7 @@ void VPWidenCallRecipe::print(raw_ostream &O, const Twine &Indent,
12841284
O << "call";
12851285
printFlags(O);
12861286
O << " @" << CalledFn->getName() << "(";
1287-
interleaveComma(arg_operands(), O, [&O, &SlotTracker](VPValue *Op) {
1287+
interleaveComma(args(), O, [&O, &SlotTracker](VPValue *Op) {
12881288
Op->printAsOperand(O, SlotTracker);
12891289
});
12901290
O << ")";

0 commit comments

Comments
 (0)