Skip to content

[VPlan] Improve code in VPWidenCallRecipe (NFC) #141926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions llvm/lib/Transforms/Vectorize/VPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -1488,8 +1488,8 @@ class VPWidenCallRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
~VPWidenCallRecipe() override = default;

VPWidenCallRecipe *clone() override {
return new VPWidenCallRecipe(getUnderlyingValue(), Variant,
{op_begin(), op_end()}, getDebugLoc());
return new VPWidenCallRecipe(getUnderlyingValue(), Variant, operands(),
getDebugLoc());
}

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

operand_range arg_operands() {
return make_range(op_begin(), op_begin() + getNumOperands() - 1);
}
const_operand_range arg_operands() const {
return make_range(op_begin(), op_begin() + getNumOperands() - 1);
operand_range args() { return make_range(op_begin(), std::prev(op_end())); }
const_operand_range args() const {
return make_range(op_begin(), std::prev(op_end()));
}

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ void VPWidenCallRecipe::execute(VPTransformState &State) {
FunctionType *VFTy = Variant->getFunctionType();
// Add return type if intrinsic is overloaded on it.
SmallVector<Value *, 4> Args;
for (const auto &I : enumerate(arg_operands())) {
for (const auto &I : enumerate(args())) {
Value *Arg;
// Some vectorized function variants may also take a scalar argument,
// e.g. linear parameters for pointers. This needs to be the scalar value
Expand Down Expand Up @@ -1284,7 +1284,7 @@ void VPWidenCallRecipe::print(raw_ostream &O, const Twine &Indent,
O << "call";
printFlags(O);
O << " @" << CalledFn->getName() << "(";
interleaveComma(arg_operands(), O, [&O, &SlotTracker](VPValue *Op) {
interleaveComma(args(), O, [&O, &SlotTracker](VPValue *Op) {
Op->printAsOperand(O, SlotTracker);
});
O << ")";
Expand Down
Loading