[VPlan] Improve code around ArrayRef construction (NFC) (#179191)

This commit is contained in:
Ramkumar Ramachandra 2026-02-02 23:01:12 +00:00 committed by GitHub
parent 0c07203e07
commit 350b138313
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1539,8 +1539,7 @@ protected:
/// VPIRInstruction::create() should be used to create VPIRInstructions, as
/// subclasses may need to be created, e.g. VPIRPhi.
VPIRInstruction(Instruction &I)
: VPRecipeBase(VPRecipeBase::VPIRInstructionSC, ArrayRef<VPValue *>()),
I(I) {}
: VPRecipeBase(VPRecipeBase::VPIRInstructionSC, {}), I(I) {}
public:
~VPIRInstruction() override = default;
@ -2006,8 +2005,8 @@ class VPVectorEndPointerRecipe : public VPRecipeWithIRFlags,
public:
VPVectorEndPointerRecipe(VPValue *Ptr, VPValue *VF, Type *SourceElementTy,
int64_t Stride, GEPNoWrapFlags GEPFlags, DebugLoc DL)
: VPRecipeWithIRFlags(VPRecipeBase::VPVectorEndPointerSC,
ArrayRef<VPValue *>({Ptr, VF}), GEPFlags, DL),
: VPRecipeWithIRFlags(VPRecipeBase::VPVectorEndPointerSC, {Ptr, VF},
GEPFlags, DL),
SourceElementTy(SourceElementTy), Stride(Stride) {
assert(Stride < 0 && "Stride must be negative");
}
@ -2142,8 +2141,7 @@ class LLVM_ABI_FOR_TEST VPHeaderPHIRecipe : public VPSingleDefRecipe,
protected:
VPHeaderPHIRecipe(unsigned char VPRecipeID, Instruction *UnderlyingInstr,
VPValue *Start, DebugLoc DL = DebugLoc::getUnknown())
: VPSingleDefRecipe(VPRecipeID, ArrayRef<VPValue *>({Start}),
UnderlyingInstr, DL) {}
: VPSingleDefRecipe(VPRecipeID, Start, UnderlyingInstr, DL) {}
const VPRecipeBase *getAsRecipe() const override { return this; }
@ -2788,9 +2786,8 @@ public:
/// Return the VPValues stored by this interleave group. If it is a load
/// interleave group, return an empty ArrayRef.
ArrayRef<VPValue *> getStoredValues() const {
return ArrayRef<VPValue *>(op_end() -
(getNumStoreOperands() + (HasMask ? 1 : 0)),
getNumStoreOperands());
return {op_end() - (getNumStoreOperands() + (HasMask ? 1 : 0)),
getNumStoreOperands()};
}
};
@ -2843,10 +2840,10 @@ protected:
class LLVM_ABI_FOR_TEST VPInterleaveEVLRecipe final : public VPInterleaveBase {
public:
VPInterleaveEVLRecipe(VPInterleaveRecipe &R, VPValue &EVL, VPValue *Mask)
: VPInterleaveBase(
VPRecipeBase::VPInterleaveEVLSC, R.getInterleaveGroup(),
ArrayRef<VPValue *>({R.getAddr(), &EVL}), R.getStoredValues(), Mask,
R.needsMaskForGaps(), R, R.getDebugLoc()) {
: VPInterleaveBase(VPRecipeBase::VPInterleaveEVLSC,
R.getInterleaveGroup(), {R.getAddr(), &EVL},
R.getStoredValues(), Mask, R.needsMaskForGaps(), R,
R.getDebugLoc()) {
assert(!getInterleaveGroup()->isReverse() &&
"Reversed interleave-group with tail folding is not supported.");
assert(!needsMaskForGaps() && "Interleaved access with gap mask is not "
@ -2918,15 +2915,13 @@ public:
VPValue *ChainOp, VPValue *VecOp, VPValue *CondOp,
ReductionStyle Style, DebugLoc DL = DebugLoc::getUnknown())
: VPReductionRecipe(VPRecipeBase::VPReductionSC, RdxKind, FMFs, I,
ArrayRef<VPValue *>({ChainOp, VecOp}), CondOp, Style,
DL) {}
{ChainOp, VecOp}, CondOp, Style, DL) {}
VPReductionRecipe(const RecurKind RdxKind, FastMathFlags FMFs,
VPValue *ChainOp, VPValue *VecOp, VPValue *CondOp,
ReductionStyle Style, DebugLoc DL = DebugLoc::getUnknown())
: VPReductionRecipe(VPRecipeBase::VPReductionSC, RdxKind, FMFs, nullptr,
ArrayRef<VPValue *>({ChainOp, VecOp}), CondOp, Style,
DL) {}
{ChainOp, VecOp}, CondOp, Style, DL) {}
~VPReductionRecipe() override = default;
@ -3006,12 +3001,12 @@ class LLVM_ABI_FOR_TEST VPReductionEVLRecipe : public VPReductionRecipe {
public:
VPReductionEVLRecipe(VPReductionRecipe &R, VPValue &EVL, VPValue *CondOp,
DebugLoc DL = DebugLoc::getUnknown())
: VPReductionRecipe(
VPRecipeBase::VPReductionEVLSC, R.getRecurrenceKind(),
R.getFastMathFlags(),
cast_or_null<Instruction>(R.getUnderlyingValue()),
ArrayRef<VPValue *>({R.getChainOp(), R.getVecOp(), &EVL}), CondOp,
getReductionStyle(/*InLoop=*/true, R.isOrdered(), 1), DL) {}
: VPReductionRecipe(VPRecipeBase::VPReductionEVLSC, R.getRecurrenceKind(),
R.getFastMathFlags(),
cast_or_null<Instruction>(R.getUnderlyingValue()),
{R.getChainOp(), R.getVecOp(), &EVL}, CondOp,
getReductionStyle(/*InLoop=*/true, R.isOrdered(), 1),
DL) {}
~VPReductionEVLRecipe() override = default;
@ -3910,8 +3905,8 @@ public:
VPScalarIVStepsRecipe(VPValue *IV, VPValue *Step, VPValue *VF,
Instruction::BinaryOps Opcode, FastMathFlags FMFs,
DebugLoc DL)
: VPRecipeWithIRFlags(VPRecipeBase::VPScalarIVStepsSC,
ArrayRef<VPValue *>({IV, Step, VF}), FMFs, DL),
: VPRecipeWithIRFlags(VPRecipeBase::VPScalarIVStepsSC, {IV, Step, VF},
FMFs, DL),
InductionOpcode(Opcode) {}
VPScalarIVStepsRecipe(const InductionDescriptor &IndDesc, VPValue *IV,