-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[TTI][LV] Simplify the prototype of preferPredicatedReductionSelect. nfc #139265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TTI][LV] Simplify the prototype of preferPredicatedReductionSelect. nfc #139265
Conversation
@llvm/pr-subscribers-backend-arm @llvm/pr-subscribers-backend-aarch64 Author: Mel Chen (Mel-Chen) ChangesFull diff: https://github.com/llvm/llvm-project/pull/139265.diff 7 Files Affected:
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index 4e2d37be3a2b2..3f639138d8b75 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -1797,7 +1797,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) const;
+ bool preferPredicatedReductionSelect() const;
/// Return true if the loop vectorizer should consider vectorizing an
/// otherwise scalar epilogue loop.
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index a440b6484e94d..a80b4c5179bad 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -1087,10 +1087,7 @@ class TargetTransformInfoImplBase {
}
virtual bool preferAlternateOpcodeVectorization() const { return true; }
- virtual bool preferPredicatedReductionSelect(unsigned Opcode,
- Type *Ty) const {
- return false;
- }
+ virtual bool preferPredicatedReductionSelect() const { return false; }
virtual bool preferEpilogueVectorization() const { return true; }
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index b7e001d86e4b3..0f857399660fe 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -1395,9 +1395,8 @@ bool TargetTransformInfo::preferAlternateOpcodeVectorization() const {
return TTIImpl->preferAlternateOpcodeVectorization();
}
-bool TargetTransformInfo::preferPredicatedReductionSelect(unsigned Opcode,
- Type *Ty) const {
- return TTIImpl->preferPredicatedReductionSelect(Opcode, Ty);
+bool TargetTransformInfo::preferPredicatedReductionSelect() const {
+ return TTIImpl->preferPredicatedReductionSelect();
}
bool TargetTransformInfo::preferEpilogueVectorization() const {
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
index cefb7b97c605b..664c360032ea3 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
@@ -435,10 +435,7 @@ class AArch64TTIImpl : public BasicTTIImplBase<AArch64TTIImpl> {
bool isLegalToVectorizeReduction(const RecurrenceDescriptor &RdxDesc,
ElementCount VF) const override;
- bool preferPredicatedReductionSelect(unsigned Opcode,
- Type *Ty) const override {
- return ST->hasSVE();
- }
+ bool preferPredicatedReductionSelect() const override { return ST->hasSVE(); }
InstructionCost
getArithmeticReductionCost(unsigned Opcode, VectorType *Ty,
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
index 3569036de767e..6c3a1ae7e1775 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
@@ -2704,8 +2704,7 @@ bool ARMTTIImpl::preferInLoopReduction(RecurKind Kind, Type *Ty) const {
}
}
-bool ARMTTIImpl::preferPredicatedReductionSelect(unsigned Opcode,
- Type *Ty) const {
+bool ARMTTIImpl::preferPredicatedReductionSelect() 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 2ce449650c3b9..20a2c59511087 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
@@ -230,8 +230,7 @@ class ARMTTIImpl : public BasicTTIImplBase<ARMTTIImpl> {
bool preferInLoopReduction(RecurKind Kind, Type *Ty) const override;
- bool preferPredicatedReductionSelect(unsigned Opcode,
- Type *Ty) const override;
+ bool preferPredicatedReductionSelect() const override;
bool shouldExpandReduction(const IntrinsicInst *II) const override {
return false;
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 9208fc45a0188..9a303f526af2f 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1446,13 +1446,13 @@ class LoopVectorizationCostModel {
/// Returns true if the predicated reduction select should be used to set the
/// incoming value for the reduction phi.
- bool usePredicatedReductionSelect(unsigned Opcode, Type *PhiTy) const {
+ bool usePredicatedReductionSelect() const {
// Force to use predicated reduction select since the EVL of the
// second-to-last iteration might not be VF*UF.
if (foldTailWithEVL())
return true;
return PreferPredicatedReductionSelect ||
- TTI.preferPredicatedReductionSelect(Opcode, PhiTy);
+ TTI.preferPredicatedReductionSelect();
}
/// Estimate cost of an intrinsic call instruction CI if it were vectorized
@@ -9908,8 +9908,7 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
cast<VPInstruction>(&U)->getOpcode() ==
VPInstruction::ComputeFindLastIVResult);
});
- if (CM.usePredicatedReductionSelect(
- PhiR->getRecurrenceDescriptor().getOpcode(), PhiTy))
+ if (CM.usePredicatedReductionSelect())
PhiR->setOperand(1, NewExitingVPV);
}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the cleanup!
6c2a2e0
to
d1c83a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/162/builds/22187 Here is the relevant piece of the build log for the reference
|
No description provided.