[llvm] e1cea0d - [LV][TTI] Remove unused ReductionFlags. NFC (#129858)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 5 02:31:16 PST 2025
Author: Luke Lau
Date: 2025-03-05T18:31:12+08:00
New Revision: e1cea0d9289db8f2f0d433c1712ad08d5176dbb0
URL: https://github.com/llvm/llvm-project/commit/e1cea0d9289db8f2f0d433c1712ad08d5176dbb0
DIFF: https://github.com/llvm/llvm-project/commit/e1cea0d9289db8f2f0d433c1712ad08d5176dbb0.diff
LOG: [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
8ca60db40bd944dc5f67e0f200a403b4e03818ea, but I presume it was replaced
by RecurrenceDescriptor.
Added:
Modified:
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
llvm/lib/Target/ARM/ARMTargetTransformInfo.h
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index a19baaba359ea..3081379bafd06 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -1766,24 +1766,13 @@ class TargetTransformInfo {
unsigned ChainSizeInBytes,
VectorType *VecTy) const;
- /// Flags describing the kind of vector reduction.
- struct ReductionFlags {
- ReductionFlags() = default;
- bool IsMaxOp =
- false; ///< If the op a min/max kind, true if it's a max operation.
- bool IsSigned = false; ///< Whether the operation is a signed int reduction.
- bool NoNaN =
- false; ///< If op is an fp min/max, whether NaNs may be present.
- };
-
/// \returns True if the targets prefers fixed width vectorization if the
/// loop vectorizer's cost-model assigns an equal cost to the fixed and
/// scalable version of the vectorized loop.
bool preferFixedOverScalableIfEqualCost() const;
/// \returns True if the target prefers reductions in loop.
- bool preferInLoopReduction(unsigned Opcode, Type *Ty,
- ReductionFlags Flags) const;
+ bool preferInLoopReduction(unsigned Opcode, Type *Ty) const;
/// \returns True if the target prefers reductions select kept in the loop
/// when tail folding. i.e.
@@ -1796,8 +1785,7 @@ class TargetTransformInfo {
/// As opposed to the normal scheme of p = phi (0, a) which allows the select
/// to be pulled out of the loop. If the select(.., add, ..) can be predicated
/// by the target, this can lead to cleaner code generation.
- bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
- ReductionFlags Flags) const;
+ bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty) const;
/// Return true if the loop vectorizer should consider vectorizing an
/// otherwise scalar epilogue loop.
@@ -2334,10 +2322,9 @@ class TargetTransformInfo::Concept {
unsigned ChainSizeInBytes,
VectorType *VecTy) const = 0;
virtual bool preferFixedOverScalableIfEqualCost() const = 0;
- virtual bool preferInLoopReduction(unsigned Opcode, Type *Ty,
- ReductionFlags) const = 0;
- virtual bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
- ReductionFlags) const = 0;
+ virtual bool preferInLoopReduction(unsigned Opcode, Type *Ty) const = 0;
+ virtual bool preferPredicatedReductionSelect(unsigned Opcode,
+ Type *Ty) const = 0;
virtual bool preferEpilogueVectorization() const = 0;
virtual bool shouldExpandReduction(const IntrinsicInst *II) const = 0;
@@ -3145,13 +3132,12 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
bool preferFixedOverScalableIfEqualCost() const override {
return Impl.preferFixedOverScalableIfEqualCost();
}
- bool preferInLoopReduction(unsigned Opcode, Type *Ty,
- ReductionFlags Flags) const override {
- return Impl.preferInLoopReduction(Opcode, Ty, Flags);
+ bool preferInLoopReduction(unsigned Opcode, Type *Ty) const override {
+ return Impl.preferInLoopReduction(Opcode, Ty);
}
- bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
- ReductionFlags Flags) const override {
- return Impl.preferPredicatedReductionSelect(Opcode, Ty, Flags);
+ bool preferPredicatedReductionSelect(unsigned Opcode,
+ Type *Ty) const override {
+ return Impl.preferPredicatedReductionSelect(Opcode, Ty);
}
bool preferEpilogueVectorization() const override {
return Impl.preferEpilogueVectorization();
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index a8d6dd18266bb..e1fabd2ebeec0 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -1006,13 +1006,9 @@ class TargetTransformInfoImplBase {
bool preferFixedOverScalableIfEqualCost() const { return false; }
- bool preferInLoopReduction(unsigned Opcode, Type *Ty,
- TTI::ReductionFlags Flags) const {
- return false;
- }
+ bool preferInLoopReduction(unsigned Opcode, Type *Ty) const { return false; }
- bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
- TTI::ReductionFlags Flags) const {
+ bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty) const {
return false;
}
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index 067b3ec10fc7a..3d43f39439625 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -1379,14 +1379,14 @@ bool TargetTransformInfo::preferFixedOverScalableIfEqualCost() const {
return TTIImpl->preferFixedOverScalableIfEqualCost();
}
-bool TargetTransformInfo::preferInLoopReduction(unsigned Opcode, Type *Ty,
- ReductionFlags Flags) const {
- return TTIImpl->preferInLoopReduction(Opcode, Ty, Flags);
+bool TargetTransformInfo::preferInLoopReduction(unsigned Opcode,
+ Type *Ty) const {
+ return TTIImpl->preferInLoopReduction(Opcode, Ty);
}
-bool TargetTransformInfo::preferPredicatedReductionSelect(
- unsigned Opcode, Type *Ty, ReductionFlags Flags) const {
- return TTIImpl->preferPredicatedReductionSelect(Opcode, Ty, Flags);
+bool TargetTransformInfo::preferPredicatedReductionSelect(unsigned Opcode,
+ Type *Ty) const {
+ return TTIImpl->preferPredicatedReductionSelect(Opcode, Ty);
}
bool TargetTransformInfo::preferEpilogueVectorization() const {
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
index c7f8450213ae5..ac4ae96be27f4 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
@@ -416,8 +416,7 @@ class AArch64TTIImpl : public BasicTTIImplBase<AArch64TTIImpl> {
bool isLegalToVectorizeReduction(const RecurrenceDescriptor &RdxDesc,
ElementCount VF) const;
- bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
- TTI::ReductionFlags Flags) const {
+ bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty) const {
return ST->hasSVE();
}
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
index 6b3fa04798061..2a2a46a19d7c1 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
@@ -2633,8 +2633,7 @@ void ARMTTIImpl::getPeelingPreferences(Loop *L, ScalarEvolution &SE,
BaseT::getPeelingPreferences(L, SE, PP);
}
-bool ARMTTIImpl::preferInLoopReduction(unsigned Opcode, Type *Ty,
- TTI::ReductionFlags Flags) const {
+bool ARMTTIImpl::preferInLoopReduction(unsigned Opcode, Type *Ty) const {
if (!ST->hasMVEIntegerOps())
return false;
@@ -2647,8 +2646,8 @@ bool ARMTTIImpl::preferInLoopReduction(unsigned Opcode, Type *Ty,
}
}
-bool ARMTTIImpl::preferPredicatedReductionSelect(
- unsigned Opcode, Type *Ty, TTI::ReductionFlags Flags) const {
+bool ARMTTIImpl::preferPredicatedReductionSelect(unsigned Opcode,
+ Type *Ty) const {
if (!ST->hasMVEIntegerOps())
return false;
return true;
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
index 3a4f940088b2e..125866b52846c 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
@@ -223,11 +223,9 @@ class ARMTTIImpl : public BasicTTIImplBase<ARMTTIImpl> {
ArrayRef<const Value *> Args = {},
const Instruction *CxtI = nullptr);
- bool preferInLoopReduction(unsigned Opcode, Type *Ty,
- TTI::ReductionFlags Flags) const;
+ bool preferInLoopReduction(unsigned Opcode, Type *Ty) const;
- bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
- TTI::ReductionFlags Flags) const;
+ bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty) const;
bool shouldExpandReduction(const IntrinsicInst *II) const { return false; }
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index cb860a472d8f7..c402b16f53b84 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1518,8 +1518,7 @@ class LoopVectorizationCostModel {
if (foldTailWithEVL())
return true;
return PreferPredicatedReductionSelect ||
- TTI.preferPredicatedReductionSelect(
- Opcode, PhiTy, TargetTransformInfo::ReductionFlags());
+ TTI.preferPredicatedReductionSelect(Opcode, PhiTy);
}
/// Estimate cost of an intrinsic call instruction CI if it were vectorized
@@ -4875,8 +4874,7 @@ void LoopVectorizationCostModel::collectElementTypesForWidening() {
Legal->getReductionVars().find(PN)->second;
if (PreferInLoopReductions || useOrderedReductions(RdxDesc) ||
TTI.preferInLoopReduction(RdxDesc.getOpcode(),
- RdxDesc.getRecurrenceType(),
- TargetTransformInfo::ReductionFlags()))
+ RdxDesc.getRecurrenceType()))
continue;
T = RdxDesc.getRecurrenceType();
}
@@ -7043,8 +7041,7 @@ void LoopVectorizationCostModel::collectInLoopReductions() {
// want to record it as such.
unsigned Opcode = RdxDesc.getOpcode();
if (!PreferInLoopReductions && !useOrderedReductions(RdxDesc) &&
- !TTI.preferInLoopReduction(Opcode, Phi->getType(),
- TargetTransformInfo::ReductionFlags()))
+ !TTI.preferInLoopReduction(Opcode, Phi->getType()))
continue;
// Check that we can correctly put the reductions into the loop, by
More information about the llvm-commits
mailing list