Skip to content

Commit e1cea0d

Browse files
authored
[LV][TTI] Remove unused ReductionFlags. NFC (#129858)
No in-tree targets currently use it in the preferInLoopReduction/preferPredicatedReductionSelect TTI hooks. It looks like it used to be used in LoopUtils, at least in 8ca60db, but I presume it was replaced by RecurrenceDescriptor.
1 parent 3fed3bf commit e1cea0d

File tree

7 files changed

+27
-52
lines changed

7 files changed

+27
-52
lines changed

llvm/include/llvm/Analysis/TargetTransformInfo.h

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,24 +1766,13 @@ class TargetTransformInfo {
17661766
unsigned ChainSizeInBytes,
17671767
VectorType *VecTy) const;
17681768

1769-
/// Flags describing the kind of vector reduction.
1770-
struct ReductionFlags {
1771-
ReductionFlags() = default;
1772-
bool IsMaxOp =
1773-
false; ///< If the op a min/max kind, true if it's a max operation.
1774-
bool IsSigned = false; ///< Whether the operation is a signed int reduction.
1775-
bool NoNaN =
1776-
false; ///< If op is an fp min/max, whether NaNs may be present.
1777-
};
1778-
17791769
/// \returns True if the targets prefers fixed width vectorization if the
17801770
/// loop vectorizer's cost-model assigns an equal cost to the fixed and
17811771
/// scalable version of the vectorized loop.
17821772
bool preferFixedOverScalableIfEqualCost() const;
17831773

17841774
/// \returns True if the target prefers reductions in loop.
1785-
bool preferInLoopReduction(unsigned Opcode, Type *Ty,
1786-
ReductionFlags Flags) const;
1775+
bool preferInLoopReduction(unsigned Opcode, Type *Ty) const;
17871776

17881777
/// \returns True if the target prefers reductions select kept in the loop
17891778
/// when tail folding. i.e.
@@ -1796,8 +1785,7 @@ class TargetTransformInfo {
17961785
/// As opposed to the normal scheme of p = phi (0, a) which allows the select
17971786
/// to be pulled out of the loop. If the select(.., add, ..) can be predicated
17981787
/// by the target, this can lead to cleaner code generation.
1799-
bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
1800-
ReductionFlags Flags) const;
1788+
bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty) const;
18011789

18021790
/// Return true if the loop vectorizer should consider vectorizing an
18031791
/// otherwise scalar epilogue loop.
@@ -2334,10 +2322,9 @@ class TargetTransformInfo::Concept {
23342322
unsigned ChainSizeInBytes,
23352323
VectorType *VecTy) const = 0;
23362324
virtual bool preferFixedOverScalableIfEqualCost() const = 0;
2337-
virtual bool preferInLoopReduction(unsigned Opcode, Type *Ty,
2338-
ReductionFlags) const = 0;
2339-
virtual bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
2340-
ReductionFlags) const = 0;
2325+
virtual bool preferInLoopReduction(unsigned Opcode, Type *Ty) const = 0;
2326+
virtual bool preferPredicatedReductionSelect(unsigned Opcode,
2327+
Type *Ty) const = 0;
23412328
virtual bool preferEpilogueVectorization() const = 0;
23422329

23432330
virtual bool shouldExpandReduction(const IntrinsicInst *II) const = 0;
@@ -3145,13 +3132,12 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
31453132
bool preferFixedOverScalableIfEqualCost() const override {
31463133
return Impl.preferFixedOverScalableIfEqualCost();
31473134
}
3148-
bool preferInLoopReduction(unsigned Opcode, Type *Ty,
3149-
ReductionFlags Flags) const override {
3150-
return Impl.preferInLoopReduction(Opcode, Ty, Flags);
3135+
bool preferInLoopReduction(unsigned Opcode, Type *Ty) const override {
3136+
return Impl.preferInLoopReduction(Opcode, Ty);
31513137
}
3152-
bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
3153-
ReductionFlags Flags) const override {
3154-
return Impl.preferPredicatedReductionSelect(Opcode, Ty, Flags);
3138+
bool preferPredicatedReductionSelect(unsigned Opcode,
3139+
Type *Ty) const override {
3140+
return Impl.preferPredicatedReductionSelect(Opcode, Ty);
31553141
}
31563142
bool preferEpilogueVectorization() const override {
31573143
return Impl.preferEpilogueVectorization();

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,13 +1006,9 @@ class TargetTransformInfoImplBase {
10061006

10071007
bool preferFixedOverScalableIfEqualCost() const { return false; }
10081008

1009-
bool preferInLoopReduction(unsigned Opcode, Type *Ty,
1010-
TTI::ReductionFlags Flags) const {
1011-
return false;
1012-
}
1009+
bool preferInLoopReduction(unsigned Opcode, Type *Ty) const { return false; }
10131010

1014-
bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
1015-
TTI::ReductionFlags Flags) const {
1011+
bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty) const {
10161012
return false;
10171013
}
10181014

llvm/lib/Analysis/TargetTransformInfo.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,14 +1379,14 @@ bool TargetTransformInfo::preferFixedOverScalableIfEqualCost() const {
13791379
return TTIImpl->preferFixedOverScalableIfEqualCost();
13801380
}
13811381

1382-
bool TargetTransformInfo::preferInLoopReduction(unsigned Opcode, Type *Ty,
1383-
ReductionFlags Flags) const {
1384-
return TTIImpl->preferInLoopReduction(Opcode, Ty, Flags);
1382+
bool TargetTransformInfo::preferInLoopReduction(unsigned Opcode,
1383+
Type *Ty) const {
1384+
return TTIImpl->preferInLoopReduction(Opcode, Ty);
13851385
}
13861386

1387-
bool TargetTransformInfo::preferPredicatedReductionSelect(
1388-
unsigned Opcode, Type *Ty, ReductionFlags Flags) const {
1389-
return TTIImpl->preferPredicatedReductionSelect(Opcode, Ty, Flags);
1387+
bool TargetTransformInfo::preferPredicatedReductionSelect(unsigned Opcode,
1388+
Type *Ty) const {
1389+
return TTIImpl->preferPredicatedReductionSelect(Opcode, Ty);
13901390
}
13911391

13921392
bool TargetTransformInfo::preferEpilogueVectorization() const {

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,7 @@ class AArch64TTIImpl : public BasicTTIImplBase<AArch64TTIImpl> {
416416
bool isLegalToVectorizeReduction(const RecurrenceDescriptor &RdxDesc,
417417
ElementCount VF) const;
418418

419-
bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
420-
TTI::ReductionFlags Flags) const {
419+
bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty) const {
421420
return ST->hasSVE();
422421
}
423422

llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,8 +2633,7 @@ void ARMTTIImpl::getPeelingPreferences(Loop *L, ScalarEvolution &SE,
26332633
BaseT::getPeelingPreferences(L, SE, PP);
26342634
}
26352635

2636-
bool ARMTTIImpl::preferInLoopReduction(unsigned Opcode, Type *Ty,
2637-
TTI::ReductionFlags Flags) const {
2636+
bool ARMTTIImpl::preferInLoopReduction(unsigned Opcode, Type *Ty) const {
26382637
if (!ST->hasMVEIntegerOps())
26392638
return false;
26402639

@@ -2647,8 +2646,8 @@ bool ARMTTIImpl::preferInLoopReduction(unsigned Opcode, Type *Ty,
26472646
}
26482647
}
26492648

2650-
bool ARMTTIImpl::preferPredicatedReductionSelect(
2651-
unsigned Opcode, Type *Ty, TTI::ReductionFlags Flags) const {
2649+
bool ARMTTIImpl::preferPredicatedReductionSelect(unsigned Opcode,
2650+
Type *Ty) const {
26522651
if (!ST->hasMVEIntegerOps())
26532652
return false;
26542653
return true;

llvm/lib/Target/ARM/ARMTargetTransformInfo.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,9 @@ class ARMTTIImpl : public BasicTTIImplBase<ARMTTIImpl> {
223223
ArrayRef<const Value *> Args = {},
224224
const Instruction *CxtI = nullptr);
225225

226-
bool preferInLoopReduction(unsigned Opcode, Type *Ty,
227-
TTI::ReductionFlags Flags) const;
226+
bool preferInLoopReduction(unsigned Opcode, Type *Ty) const;
228227

229-
bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
230-
TTI::ReductionFlags Flags) const;
228+
bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty) const;
231229

232230
bool shouldExpandReduction(const IntrinsicInst *II) const { return false; }
233231

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,8 +1518,7 @@ class LoopVectorizationCostModel {
15181518
if (foldTailWithEVL())
15191519
return true;
15201520
return PreferPredicatedReductionSelect ||
1521-
TTI.preferPredicatedReductionSelect(
1522-
Opcode, PhiTy, TargetTransformInfo::ReductionFlags());
1521+
TTI.preferPredicatedReductionSelect(Opcode, PhiTy);
15231522
}
15241523

15251524
/// Estimate cost of an intrinsic call instruction CI if it were vectorized
@@ -4875,8 +4874,7 @@ void LoopVectorizationCostModel::collectElementTypesForWidening() {
48754874
Legal->getReductionVars().find(PN)->second;
48764875
if (PreferInLoopReductions || useOrderedReductions(RdxDesc) ||
48774876
TTI.preferInLoopReduction(RdxDesc.getOpcode(),
4878-
RdxDesc.getRecurrenceType(),
4879-
TargetTransformInfo::ReductionFlags()))
4877+
RdxDesc.getRecurrenceType()))
48804878
continue;
48814879
T = RdxDesc.getRecurrenceType();
48824880
}
@@ -7043,8 +7041,7 @@ void LoopVectorizationCostModel::collectInLoopReductions() {
70437041
// want to record it as such.
70447042
unsigned Opcode = RdxDesc.getOpcode();
70457043
if (!PreferInLoopReductions && !useOrderedReductions(RdxDesc) &&
7046-
!TTI.preferInLoopReduction(Opcode, Phi->getType(),
7047-
TargetTransformInfo::ReductionFlags()))
7044+
!TTI.preferInLoopReduction(Opcode, Phi->getType()))
70487045
continue;
70497046

70507047
// Check that we can correctly put the reductions into the loop, by

0 commit comments

Comments
 (0)