Skip to content

Commit f057a59

Browse files
authored
[VPlan] Improve code in VPWidenCallRecipe (NFC) (#141926)
Use operands() instead of {op_begin(), op_end()}. Also rename arg_operands to args to match CallBase.
1 parent 07ba406 commit f057a59

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
@@ -1500,8 +1500,8 @@ class VPWidenCallRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15001500
~VPWidenCallRecipe() override = default;
15011501

15021502
VPWidenCallRecipe *clone() override {
1503-
return new VPWidenCallRecipe(getUnderlyingValue(), Variant,
1504-
{op_begin(), op_end()}, getDebugLoc());
1503+
return new VPWidenCallRecipe(getUnderlyingValue(), Variant, operands(),
1504+
getDebugLoc());
15051505
}
15061506

15071507
VP_CLASSOF_IMPL(VPDef::VPWidenCallSC)
@@ -1517,11 +1517,9 @@ class VPWidenCallRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15171517
return cast<Function>(getOperand(getNumOperands() - 1)->getLiveInIRValue());
15181518
}
15191519

1520-
operand_range arg_operands() {
1521-
return make_range(op_begin(), op_begin() + getNumOperands() - 1);
1522-
}
1523-
const_operand_range arg_operands() const {
1524-
return make_range(op_begin(), op_begin() + getNumOperands() - 1);
1520+
operand_range args() { return make_range(op_begin(), std::prev(op_end())); }
1521+
const_operand_range args() const {
1522+
return make_range(op_begin(), std::prev(op_end()));
15251523
}
15261524

15271525
#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
@@ -1240,7 +1240,7 @@ void VPWidenCallRecipe::execute(VPTransformState &State) {
12401240
FunctionType *VFTy = Variant->getFunctionType();
12411241
// Add return type if intrinsic is overloaded on it.
12421242
SmallVector<Value *, 4> Args;
1243-
for (const auto &I : enumerate(arg_operands())) {
1243+
for (const auto &I : enumerate(args())) {
12441244
Value *Arg;
12451245
// Some vectorized function variants may also take a scalar argument,
12461246
// e.g. linear parameters for pointers. This needs to be the scalar value
@@ -1289,7 +1289,7 @@ void VPWidenCallRecipe::print(raw_ostream &O, const Twine &Indent,
12891289
O << "call";
12901290
printFlags(O);
12911291
O << " @" << CalledFn->getName() << "(";
1292-
interleaveComma(arg_operands(), O, [&O, &SlotTracker](VPValue *Op) {
1292+
interleaveComma(args(), O, [&O, &SlotTracker](VPValue *Op) {
12931293
Op->printAsOperand(O, SlotTracker);
12941294
});
12951295
O << ")";

0 commit comments

Comments
 (0)