[llvm] f057a59 - [VPlan] Improve code in VPWidenCallRecipe (NFC) (#141926)
via llvm-commits
llvm-commits at lists.llvm.org
Sat May 31 06:41:23 PDT 2025
Author: Ramkumar Ramachandra
Date: 2025-05-31T15:41:20+02:00
New Revision: f057a593a7151437edd25cfbbdcf450139346f12
URL: https://github.com/llvm/llvm-project/commit/f057a593a7151437edd25cfbbdcf450139346f12
DIFF: https://github.com/llvm/llvm-project/commit/f057a593a7151437edd25cfbbdcf450139346f12.diff
LOG: [VPlan] Improve code in VPWidenCallRecipe (NFC) (#141926)
Use operands() instead of {op_begin(), op_end()}. Also rename
arg_operands to args to match CallBase.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 3e6f737de60a6..389a63c8ecf9f 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1500,8 +1500,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)
@@ -1517,11 +1517,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)
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 4ee2fdecf2813..ca9876175d3c0 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -1240,7 +1240,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
@@ -1289,7 +1289,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 << ")";
More information about the llvm-commits
mailing list