Skip to content
Open
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
9 changes: 5 additions & 4 deletions llvm/lib/Analysis/IVDescriptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1226,10 +1226,6 @@ unsigned RecurrenceDescriptor::getOpcode(RecurKind Kind) {
case RecurKind::Mul:
return Instruction::Mul;
case RecurKind::AnyOf:
case RecurKind::FindFirstIVSMin:
case RecurKind::FindFirstIVUMin:
case RecurKind::FindLastIVSMax:
case RecurKind::FindLastIVUMax:
case RecurKind::Or:
return Instruction::Or;
case RecurKind::And:
Expand All @@ -1253,6 +1249,11 @@ unsigned RecurrenceDescriptor::getOpcode(RecurKind Kind) {
case RecurKind::FMaximumNum:
case RecurKind::FMinimumNum:
return Instruction::FCmp;
case RecurKind::FindFirstIVSMin:
case RecurKind::FindFirstIVUMin:
case RecurKind::FindLastIVSMax:
case RecurKind::FindLastIVUMax:
return Instruction::Select;
default:
llvm_unreachable("Unknown recurrence operation");
}
Expand Down
7 changes: 6 additions & 1 deletion llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6515,9 +6515,14 @@ void LoopVectorizationCostModel::collectInLoopReductions() {
if (RdxDesc.getRecurrenceType() != Phi->getType())
continue;

// In-loop AnyOf and FindIV reductions are not yet supported.
RecurKind Kind = RdxDesc.getRecurrenceKind();
if (RecurrenceDescriptor::isAnyOfRecurrenceKind(Kind) ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, can we make Find* unreachable in getOpcode for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is another way #163541. We only need to land either #163541 or this patch.
Please let me know which patch you prefer.

RecurrenceDescriptor::isFindIVRecurrenceKind(Kind))
continue;

// If the target would prefer this reduction to happen "in-loop", then we
// want to record it as such.
RecurKind Kind = RdxDesc.getRecurrenceKind();
if (!PreferInLoopReductions && !useOrderedReductions(RdxDesc) &&
!TTI.preferInLoopReduction(Kind, Phi->getType()))
continue;
Expand Down
Loading