Skip to content

Commit b3bcf16

Browse files
committed
[IVDescriptors] Change opcode of FindLast/FindFirst recurrence to Instruction::Select
1 parent e706a30 commit b3bcf16

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

llvm/lib/Analysis/IVDescriptors.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,10 +1226,6 @@ unsigned RecurrenceDescriptor::getOpcode(RecurKind Kind) {
12261226
case RecurKind::Mul:
12271227
return Instruction::Mul;
12281228
case RecurKind::AnyOf:
1229-
case RecurKind::FindFirstIVSMin:
1230-
case RecurKind::FindFirstIVUMin:
1231-
case RecurKind::FindLastIVSMax:
1232-
case RecurKind::FindLastIVUMax:
12331229
case RecurKind::Or:
12341230
return Instruction::Or;
12351231
case RecurKind::And:
@@ -1253,6 +1249,11 @@ unsigned RecurrenceDescriptor::getOpcode(RecurKind Kind) {
12531249
case RecurKind::FMaximumNum:
12541250
case RecurKind::FMinimumNum:
12551251
return Instruction::FCmp;
1252+
case RecurKind::FindFirstIVSMin:
1253+
case RecurKind::FindFirstIVUMin:
1254+
case RecurKind::FindLastIVSMax:
1255+
case RecurKind::FindLastIVUMax:
1256+
return Instruction::Select;
12561257
default:
12571258
llvm_unreachable("Unknown recurrence operation");
12581259
}

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6515,9 +6515,14 @@ void LoopVectorizationCostModel::collectInLoopReductions() {
65156515
if (RdxDesc.getRecurrenceType() != Phi->getType())
65166516
continue;
65176517

6518+
// In-loop AnyOf and FindIV reductions are not yet supported.
6519+
RecurKind Kind = RdxDesc.getRecurrenceKind();
6520+
if (RecurrenceDescriptor::isAnyOfRecurrenceKind(Kind) ||
6521+
RecurrenceDescriptor::isFindIVRecurrenceKind(Kind))
6522+
continue;
6523+
65186524
// If the target would prefer this reduction to happen "in-loop", then we
65196525
// want to record it as such.
6520-
RecurKind Kind = RdxDesc.getRecurrenceKind();
65216526
if (!PreferInLoopReductions && !useOrderedReductions(RdxDesc) &&
65226527
!TTI.preferInLoopReduction(Kind, Phi->getType()))
65236528
continue;

0 commit comments

Comments
 (0)