From bb8c42e859871aaf6bbec78dee28f124d47348dd Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Mon, 23 Jun 2025 15:27:49 +0100 Subject: [LV] Extend FindLastIV to unsigned case (#141752) Split the FindLastIV RecurKind into SMax and UMax variants, depending on the reduction op produced. --- llvm/lib/Transforms/Utils/LoopUtils.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp') 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. -- cgit v1.1