Skip to content

Commit 0d7b34b

Browse files
committed
[LoopUtils] Pass start value directly to createAnyOfReduction (NFC).
Now that there is only a single AnyOf recurrence kind, simply pass the start value instead of the full recurrence descriptor, to tighten the interface.
1 parent 6efd24c commit 0d7b34b

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,9 @@ Value *createSimpleReduction(IRBuilderBase &B, Value *Src,
413413
/// reduction.
414414
Value *createSimpleReduction(VectorBuilder &VB, Value *Src, RecurKind RdxKind);
415415

416-
/// Create a reduction of the given vector \p Src for a reduction of the
417-
/// kind RecurKind::IAnyOf or RecurKind::FAnyOf. The reduction operation is
418-
/// described by \p Desc.
419-
Value *createAnyOfReduction(IRBuilderBase &B, Value *Src,
420-
const RecurrenceDescriptor &Desc,
416+
/// Create a reduction of the given vector \p Src for a reduction of kind
417+
/// RecurKind::AnyOf. The start value of the reduction is \p InitVal.
418+
Value *createAnyOfReduction(IRBuilderBase &B, Value *Src, Value *InitVal,
421419
PHINode *OrigPhi);
422420

423421
/// Create a reduction of the given vector \p Src for a reduction of the

llvm/lib/Transforms/Utils/LoopUtils.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,12 +1207,7 @@ Value *llvm::getShuffleReduction(IRBuilderBase &Builder, Value *Src,
12071207
}
12081208

12091209
Value *llvm::createAnyOfReduction(IRBuilderBase &Builder, Value *Src,
1210-
const RecurrenceDescriptor &Desc,
1211-
PHINode *OrigPhi) {
1212-
assert(
1213-
RecurrenceDescriptor::isAnyOfRecurrenceKind(Desc.getRecurrenceKind()) &&
1214-
"Unexpected reduction kind");
1215-
Value *InitVal = Desc.getRecurrenceStartValue();
1210+
Value *InitVal, PHINode *OrigPhi) {
12161211
Value *NewVal = nullptr;
12171212

12181213
// First use the original phi to determine the new value we're trying to

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,8 @@ Value *VPInstruction::generate(VPTransformState &State) {
688688
// descriptor.
689689
if (RecurrenceDescriptor::isAnyOfRecurrenceKind(RK))
690690
ReducedPartRdx =
691-
createAnyOfReduction(Builder, ReducedPartRdx, RdxDesc, OrigPhi);
691+
createAnyOfReduction(Builder, ReducedPartRdx,
692+
RdxDesc.getRecurrenceStartValue(), OrigPhi);
692693
else
693694
ReducedPartRdx = createSimpleReduction(Builder, ReducedPartRdx, RK);
694695

0 commit comments

Comments
 (0)