Skip to content

Commit e13970c

Browse files
author
git apple-llvm automerger
committed
Merge commit '8d02529f77f8' from llvm.org/main into next
2 parents 37dda57 + 8d02529 commit e13970c

File tree

2 files changed

+25
-50
lines changed

2 files changed

+25
-50
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8749,7 +8749,7 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(Instruction *I,
87498749
Plan.getOrAddLiveIn(ConstantInt::get(I->getType(), 1u, false));
87508750
auto *SafeRHS = Builder.createSelect(Mask, Ops[1], One, I->getDebugLoc());
87518751
Ops[1] = SafeRHS;
8752-
return new VPWidenRecipe(*I, make_range(Ops.begin(), Ops.end()));
8752+
return new VPWidenRecipe(*I, Ops);
87538753
}
87548754
[[fallthrough]];
87558755
}
@@ -8795,7 +8795,7 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(Instruction *I,
87958795
// For other binops, the legacy cost model only checks the second operand.
87968796
NewOps[1] = GetConstantViaSCEV(NewOps[1]);
87978797
}
8798-
return new VPWidenRecipe(*I, make_range(NewOps.begin(), NewOps.end()));
8798+
return new VPWidenRecipe(*I, NewOps);
87998799
}
88008800
case Instruction::ExtractValue: {
88018801
SmallVector<VPValue *> NewOps(Operands);
@@ -8804,7 +8804,7 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(Instruction *I,
88048804
assert(EVI->getNumIndices() == 1 && "Expected one extractvalue index");
88058805
unsigned Idx = EVI->getIndices()[0];
88068806
NewOps.push_back(Plan.getOrAddLiveIn(ConstantInt::get(I32Ty, Idx, false)));
8807-
return new VPWidenRecipe(*I, make_range(NewOps.begin(), NewOps.end()));
8807+
return new VPWidenRecipe(*I, NewOps);
88088808
}
88098809
};
88108810
}
@@ -8828,9 +8828,7 @@ VPRecipeBuilder::tryToWidenHistogram(const HistogramInfo *HI,
88288828
if (Legal->isMaskRequired(HI->Store))
88298829
HGramOps.push_back(getBlockInMask(HI->Store->getParent()));
88308830

8831-
return new VPHistogramRecipe(Opcode,
8832-
make_range(HGramOps.begin(), HGramOps.end()),
8833-
HI->Store->getDebugLoc());
8831+
return new VPHistogramRecipe(Opcode, HGramOps, HI->Store->getDebugLoc());
88348832
}
88358833

88368834
VPReplicateRecipe *
@@ -8891,8 +8889,7 @@ VPRecipeBuilder::handleReplication(Instruction *I, ArrayRef<VPValue *> Operands,
88918889
assert((Range.Start.isScalar() || !IsUniform || !IsPredicated ||
88928890
(Range.Start.isScalable() && isa<IntrinsicInst>(I))) &&
88938891
"Should not predicate a uniform recipe");
8894-
auto *Recipe = new VPReplicateRecipe(
8895-
I, make_range(Operands.begin(), Operands.end()), IsUniform, BlockInMask);
8892+
auto *Recipe = new VPReplicateRecipe(I, Operands, IsUniform, BlockInMask);
88968893
return Recipe;
88978894
}
88988895

@@ -9081,12 +9078,10 @@ VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(
90819078
return nullptr;
90829079

90839080
if (auto *GEP = dyn_cast<GetElementPtrInst>(Instr))
9084-
return new VPWidenGEPRecipe(GEP,
9085-
make_range(Operands.begin(), Operands.end()));
9081+
return new VPWidenGEPRecipe(GEP, Operands);
90869082

90879083
if (auto *SI = dyn_cast<SelectInst>(Instr)) {
9088-
return new VPWidenSelectRecipe(
9089-
*SI, make_range(Operands.begin(), Operands.end()));
9084+
return new VPWidenSelectRecipe(*SI, Operands);
90909085
}
90919086

90929087
if (auto *CI = dyn_cast<CastInst>(Instr)) {
@@ -9117,7 +9112,7 @@ VPRecipeBuilder::tryToCreatePartialReduction(Instruction *Reduction,
91179112
SmallVector<VPValue *, 2> Ops;
91189113
Ops.push_back(Plan.getOrAddLiveIn(Zero));
91199114
Ops.push_back(BinOp);
9120-
BinOp = new VPWidenRecipe(*Reduction, make_range(Ops.begin(), Ops.end()));
9115+
BinOp = new VPWidenRecipe(*Reduction, Ops);
91219116
Builder.insert(BinOp->getDefiningRecipe());
91229117
ReductionOpcode = Instruction::Add;
91239118
}

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,6 @@ class VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
386386
DebugLoc DL = {})
387387
: VPDef(SC), VPUser(Operands), DL(DL) {}
388388

389-
template <typename IterT>
390-
VPRecipeBase(const unsigned char SC, iterator_range<IterT> Operands,
391-
DebugLoc DL = {})
392-
: VPDef(SC), VPUser(Operands), DL(DL) {}
393389
virtual ~VPRecipeBase() = default;
394390

395391
/// Clone the current recipe.
@@ -504,17 +500,12 @@ class VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
504500
/// Note that VPRecipeBase must be inherited from before VPValue.
505501
class VPSingleDefRecipe : public VPRecipeBase, public VPValue {
506502
public:
507-
template <typename IterT>
508-
VPSingleDefRecipe(const unsigned char SC, IterT Operands, DebugLoc DL = {})
509-
: VPRecipeBase(SC, Operands, DL), VPValue(this) {}
510-
511503
VPSingleDefRecipe(const unsigned char SC, ArrayRef<VPValue *> Operands,
512504
DebugLoc DL = {})
513505
: VPRecipeBase(SC, Operands, DL), VPValue(this) {}
514506

515-
template <typename IterT>
516-
VPSingleDefRecipe(const unsigned char SC, IterT Operands, Value *UV,
517-
DebugLoc DL = {})
507+
VPSingleDefRecipe(const unsigned char SC, ArrayRef<VPValue *> Operands,
508+
Value *UV, DebugLoc DL = {})
518509
: VPRecipeBase(SC, Operands, DL), VPValue(this, UV) {}
519510

520511
static inline bool classof(const VPRecipeBase *R) {
@@ -648,15 +639,15 @@ class VPRecipeWithIRFlags : public VPSingleDefRecipe {
648639
}
649640

650641
public:
651-
template <typename IterT>
652-
VPRecipeWithIRFlags(const unsigned char SC, IterT Operands, DebugLoc DL = {})
642+
VPRecipeWithIRFlags(const unsigned char SC, ArrayRef<VPValue *> Operands,
643+
DebugLoc DL = {})
653644
: VPSingleDefRecipe(SC, Operands, DL) {
654645
OpType = OperationType::Other;
655646
AllFlags = 0;
656647
}
657648

658-
template <typename IterT>
659-
VPRecipeWithIRFlags(const unsigned char SC, IterT Operands, Instruction &I)
649+
VPRecipeWithIRFlags(const unsigned char SC, ArrayRef<VPValue *> Operands,
650+
Instruction &I)
660651
: VPSingleDefRecipe(SC, Operands, &I, I.getDebugLoc()) {
661652
if (auto *Op = dyn_cast<CmpInst>(&I)) {
662653
OpType = OperationType::Cmp;
@@ -685,33 +676,28 @@ class VPRecipeWithIRFlags : public VPSingleDefRecipe {
685676
}
686677
}
687678

688-
template <typename IterT>
689-
VPRecipeWithIRFlags(const unsigned char SC, IterT Operands,
679+
VPRecipeWithIRFlags(const unsigned char SC, ArrayRef<VPValue *> Operands,
690680
CmpInst::Predicate Pred, DebugLoc DL = {})
691681
: VPSingleDefRecipe(SC, Operands, DL), OpType(OperationType::Cmp),
692682
CmpPredicate(Pred) {}
693683

694-
template <typename IterT>
695-
VPRecipeWithIRFlags(const unsigned char SC, IterT Operands,
684+
VPRecipeWithIRFlags(const unsigned char SC, ArrayRef<VPValue *> Operands,
696685
WrapFlagsTy WrapFlags, DebugLoc DL = {})
697686
: VPSingleDefRecipe(SC, Operands, DL),
698687
OpType(OperationType::OverflowingBinOp), WrapFlags(WrapFlags) {}
699688

700-
template <typename IterT>
701-
VPRecipeWithIRFlags(const unsigned char SC, IterT Operands,
689+
VPRecipeWithIRFlags(const unsigned char SC, ArrayRef<VPValue *> Operands,
702690
FastMathFlags FMFs, DebugLoc DL = {})
703691
: VPSingleDefRecipe(SC, Operands, DL), OpType(OperationType::FPMathOp),
704692
FMFs(FMFs) {}
705693

706-
template <typename IterT>
707-
VPRecipeWithIRFlags(const unsigned char SC, IterT Operands,
694+
VPRecipeWithIRFlags(const unsigned char SC, ArrayRef<VPValue *> Operands,
708695
DisjointFlagsTy DisjointFlags, DebugLoc DL = {})
709696
: VPSingleDefRecipe(SC, Operands, DL), OpType(OperationType::DisjointOp),
710697
DisjointFlags(DisjointFlags) {}
711698

712699
protected:
713-
template <typename IterT>
714-
VPRecipeWithIRFlags(const unsigned char SC, IterT Operands,
700+
VPRecipeWithIRFlags(const unsigned char SC, ArrayRef<VPValue *> Operands,
715701
GEPNoWrapFlags GEPFlags, DebugLoc DL = {})
716702
: VPSingleDefRecipe(SC, Operands, DL), OpType(OperationType::GEPOp),
717703
GEPFlags(GEPFlags) {}
@@ -1225,15 +1211,13 @@ class VPWidenRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
12251211
unsigned Opcode;
12261212

12271213
protected:
1228-
template <typename IterT>
12291214
VPWidenRecipe(unsigned VPDefOpcode, Instruction &I,
1230-
iterator_range<IterT> Operands)
1215+
ArrayRef<VPValue *> Operands)
12311216
: VPRecipeWithIRFlags(VPDefOpcode, Operands, I), VPIRMetadata(I),
12321217
Opcode(I.getOpcode()) {}
12331218

12341219
public:
1235-
template <typename IterT>
1236-
VPWidenRecipe(Instruction &I, iterator_range<IterT> Operands)
1220+
VPWidenRecipe(Instruction &I, ArrayRef<VPValue *> Operands)
12371221
: VPWidenRecipe(VPDef::VPWidenSC, I, Operands) {}
12381222

12391223
~VPWidenRecipe() override = default;
@@ -1466,8 +1450,7 @@ class VPHistogramRecipe : public VPRecipeBase {
14661450
unsigned Opcode;
14671451

14681452
public:
1469-
template <typename IterT>
1470-
VPHistogramRecipe(unsigned Opcode, iterator_range<IterT> Operands,
1453+
VPHistogramRecipe(unsigned Opcode, ArrayRef<VPValue *> Operands,
14711454
DebugLoc DL = {})
14721455
: VPRecipeBase(VPDef::VPHistogramSC, Operands, DL), Opcode(Opcode) {}
14731456

@@ -1503,8 +1486,7 @@ class VPHistogramRecipe : public VPRecipeBase {
15031486

15041487
/// A recipe for widening select instructions.
15051488
struct VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
1506-
template <typename IterT>
1507-
VPWidenSelectRecipe(SelectInst &I, iterator_range<IterT> Operands)
1489+
VPWidenSelectRecipe(SelectInst &I, ArrayRef<VPValue *> Operands)
15081490
: VPRecipeWithIRFlags(VPDef::VPWidenSelectSC, Operands, I),
15091491
VPIRMetadata(I) {}
15101492

@@ -1563,8 +1545,7 @@ class VPWidenGEPRecipe : public VPRecipeWithIRFlags {
15631545
}
15641546

15651547
public:
1566-
template <typename IterT>
1567-
VPWidenGEPRecipe(GetElementPtrInst *GEP, iterator_range<IterT> Operands)
1548+
VPWidenGEPRecipe(GetElementPtrInst *GEP, ArrayRef<VPValue *> Operands)
15681549
: VPRecipeWithIRFlags(VPDef::VPWidenGEPSC, Operands, *GEP) {
15691550
SmallVector<std::pair<unsigned, MDNode *>> Metadata;
15701551
(void)Metadata;
@@ -2489,8 +2470,7 @@ class VPReplicateRecipe : public VPRecipeWithIRFlags {
24892470
bool IsPredicated;
24902471

24912472
public:
2492-
template <typename IterT>
2493-
VPReplicateRecipe(Instruction *I, iterator_range<IterT> Operands,
2473+
VPReplicateRecipe(Instruction *I, ArrayRef<VPValue *> Operands,
24942474
bool IsUniform, VPValue *Mask = nullptr)
24952475
: VPRecipeWithIRFlags(VPDef::VPReplicateSC, Operands, *I),
24962476
IsUniform(IsUniform), IsPredicated(Mask) {

0 commit comments

Comments
 (0)