Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/include/llvm/Analysis/TargetTransformInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 1 addition & 4 deletions llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/Analysis/TargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 1 addition & 4 deletions llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/ARM/ARMTargetTransformInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 3 additions & 4 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -9909,8 +9909,7 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
cast<VPInstruction>(&U)->getOpcode() ==
VPInstruction::ComputeFindLastIVResult);
});
if (CM.usePredicatedReductionSelect(
PhiR->getRecurrenceDescriptor().getOpcode(), PhiTy))
if (CM.usePredicatedReductionSelect())
PhiR->setOperand(1, NewExitingVPV);
}

Expand Down
Loading