[llvm] [LV] Add support for cmp reductions with decreasing IVs. (PR #140451)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 27 02:24:16 PDT 2025
================
@@ -741,9 +741,17 @@ Value *VPInstruction::generate(VPTransformState &State) {
// sentinel value, followed by one operand for each part of the reduction.
unsigned UF = getNumOperands() - 3;
Value *ReducedPartRdx = State.get(getOperand(3));
- RecurKind MinMaxKind = RecurrenceDescriptor::isSignedRecurrenceKind(RK)
- ? RecurKind::SMax
- : RecurKind::UMax;
+ RecurKind MinMaxKind;
+ bool IsSigned = RecurrenceDescriptor::isSignedRecurrenceKind(RK);
+ if (RecurrenceDescriptor::isFindLastIVRecurrenceKind(RK)) {
+ MinMaxKind = IsSigned ? RecurKind::SMax : RecurKind::UMax;
+ } else {
+ assert(RecurrenceDescriptor::isFindFirstIVRecurrenceKind(RK) &&
+ "Kind must either be a FindLastIV or FindFirstIV");
+ assert(IsSigned &&
+ "only FindFirstIV with SMax is supported at the moment");
----------------
artagnon wrote:
```suggestion
"Only FindFirstIV with SMax is currently supported");
```
https://github.com/llvm/llvm-project/pull/140451
More information about the llvm-commits
mailing list