aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUtils.cpp
diff options
context:
space:
mode:
authorRamkumar Ramachandra <ramkumar.ramachandra@codasip.com>2025-06-23 15:27:49 +0100
committerGitHub <noreply@github.com>2025-06-23 15:27:49 +0100
commitbb8c42e859871aaf6bbec78dee28f124d47348dd (patch)
treed9ce8dc2dda236c00ac5336babbbcf62bc212550 /llvm/lib/Transforms/Utils/LoopUtils.cpp
parent6d17eb5126b352c7929e2cfcd2440c3bd70ec907 (diff)
downloadllvm-bb8c42e859871aaf6bbec78dee28f124d47348dd.zip
llvm-bb8c42e859871aaf6bbec78dee28f124d47348dd.tar.gz
llvm-bb8c42e859871aaf6bbec78dee28f124d47348dd.tar.bz2
[LV] Extend FindLastIV to unsigned case (#141752)
Split the FindLastIV RecurKind into SMax and UMax variants, depending on the reduction op produced.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUtils.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index cf6b183..c50bb4a 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -1224,9 +1224,11 @@ Value *llvm::createAnyOfReduction(IRBuilderBase &Builder, Value *Src,
}
Value *llvm::createFindLastIVReduction(IRBuilderBase &Builder, Value *Src,
- Value *Start, Value *Sentinel) {
+ RecurKind RdxKind, Value *Start,
+ Value *Sentinel) {
+ bool IsSigned = RecurrenceDescriptor::isSignedRecurrenceKind(RdxKind);
Value *MaxRdx = Src->getType()->isVectorTy()
- ? Builder.CreateIntMaxReduce(Src, true)
+ ? Builder.CreateIntMaxReduce(Src, IsSigned)
: Src;
// Correct the final reduction result back to the start value if the maximum
// reduction is sentinel value.