Skip to content

Commit 479ff4c

Browse files
fhahnsivan-shani
authored andcommitted
[LoopUtils] Pass sentinel value directly to createFindLastIVRed (NFC).
Now that there is only a single FindLastIV recurrence kind, simply pass the sentinel value instead of the full recurrence descriptor to tighten the interface.
1 parent 08f03af commit 479ff4c

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

llvm/include/llvm/Transforms/Utils/LoopUtils.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,9 @@ Value *createAnyOfReduction(IRBuilderBase &B, Value *Src, Value *InitVal,
419419
PHINode *OrigPhi);
420420

421421
/// Create a reduction of the given vector \p Src for a reduction of the
422-
/// kind RecurKind::IFindLastIV or RecurKind::FFindLastIV. The reduction
423-
/// operation is described by \p Desc.
422+
/// kind RecurKind::FindLastIV.
424423
Value *createFindLastIVReduction(IRBuilderBase &B, Value *Src, Value *Start,
425-
const RecurrenceDescriptor &Desc);
424+
Value *Sentinel);
426425

427426
/// Create an ordered reduction intrinsic using the given recurrence
428427
/// kind \p RdxKind.

llvm/lib/Transforms/Utils/LoopUtils.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,12 +1237,7 @@ Value *llvm::createAnyOfReduction(IRBuilderBase &Builder, Value *Src,
12371237
}
12381238

12391239
Value *llvm::createFindLastIVReduction(IRBuilderBase &Builder, Value *Src,
1240-
Value *Start,
1241-
const RecurrenceDescriptor &Desc) {
1242-
assert(RecurrenceDescriptor::isFindLastIVRecurrenceKind(
1243-
Desc.getRecurrenceKind()) &&
1244-
"Unexpected reduction kind");
1245-
Value *Sentinel = Desc.getSentinelValue();
1240+
Value *Start, Value *Sentinel) {
12461241
Value *MaxRdx = Src->getType()->isVectorTy()
12471242
? Builder.CreateIntMaxReduce(Src, true)
12481243
: Src;

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,8 @@ Value *VPInstruction::generate(VPTransformState &State) {
626626
}
627627

628628
return createFindLastIVReduction(Builder, ReducedPartRdx,
629-
State.get(getOperand(1), true), RdxDesc);
629+
State.get(getOperand(1), true),
630+
RdxDesc.getSentinelValue());
630631
}
631632
case VPInstruction::ComputeReductionResult: {
632633
// FIXME: The cross-recipe dependency on VPReductionPHIRecipe is temporary

0 commit comments

Comments
 (0)