[llvm] 249301c - [LoopUtils] Pass sentinel value directly to createFindLastIVRed (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed May 28 14:00:24 PDT 2025
Author: Florian Hahn
Date: 2025-05-28T22:00:11+01:00
New Revision: 249301c7794af82ea2f7b3b83d52d046e6856261
URL: https://github.com/llvm/llvm-project/commit/249301c7794af82ea2f7b3b83d52d046e6856261
DIFF: https://github.com/llvm/llvm-project/commit/249301c7794af82ea2f7b3b83d52d046e6856261.diff
LOG: [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.
Added:
Modified:
llvm/include/llvm/Transforms/Utils/LoopUtils.h
llvm/lib/Transforms/Utils/LoopUtils.cpp
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Utils/LoopUtils.h b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
index f52f8922ea8cc..3ad1113ecacf7 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
@@ -419,10 +419,9 @@ Value *createAnyOfReduction(IRBuilderBase &B, Value *Src, Value *InitVal,
PHINode *OrigPhi);
/// Create a reduction of the given vector \p Src for a reduction of the
-/// kind RecurKind::IFindLastIV or RecurKind::FFindLastIV. The reduction
-/// operation is described by \p Desc.
+/// kind RecurKind::FindLastIV.
Value *createFindLastIVReduction(IRBuilderBase &B, Value *Src, Value *Start,
- const RecurrenceDescriptor &Desc);
+ Value *Sentinel);
/// Create an ordered reduction intrinsic using the given recurrence
/// kind \p RdxKind.
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index 67efafe2ef2d9..3621989424e83 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -1237,12 +1237,7 @@ Value *llvm::createAnyOfReduction(IRBuilderBase &Builder, Value *Src,
}
Value *llvm::createFindLastIVReduction(IRBuilderBase &Builder, Value *Src,
- Value *Start,
- const RecurrenceDescriptor &Desc) {
- assert(RecurrenceDescriptor::isFindLastIVRecurrenceKind(
- Desc.getRecurrenceKind()) &&
- "Unexpected reduction kind");
- Value *Sentinel = Desc.getSentinelValue();
+ Value *Start, Value *Sentinel) {
Value *MaxRdx = Src->getType()->isVectorTy()
? Builder.CreateIntMaxReduce(Src, true)
: Src;
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index ad84b412af31d..266f658b1f9c1 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -626,7 +626,8 @@ Value *VPInstruction::generate(VPTransformState &State) {
}
return createFindLastIVReduction(Builder, ReducedPartRdx,
- State.get(getOperand(1), true), RdxDesc);
+ State.get(getOperand(1), true),
+ RdxDesc.getSentinelValue());
}
case VPInstruction::ComputeReductionResult: {
// FIXME: The cross-recipe dependency on VPReductionPHIRecipe is temporary
More information about the llvm-commits
mailing list