[llvm] [LV] Add support for cmp reductions with decreasing IVs. (PR #140451)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Wed May 28 04:39:08 PDT 2025
================
@@ -621,8 +621,16 @@ Value *VPInstruction::generate(VPTransformState &State) {
unsigned UF = getNumOperands() - 2;
Value *ReducedPartRdx = State.get(getOperand(2));
for (unsigned Part = 1; Part < UF; ++Part) {
- ReducedPartRdx = createMinMaxOp(Builder, RecurKind::SMax, ReducedPartRdx,
- State.get(getOperand(2 + Part)));
+ if (RK == RecurKind::FindLastIV)
+ ReducedPartRdx =
+ createMinMaxOp(Builder, RecurKind::SMax, ReducedPartRdx,
+ State.get(getOperand(2 + Part)));
+ else
+ ReducedPartRdx =
+ createMinMaxOp(Builder,
+ RK == RecurKind::FindFirstIVSMin ? RecurKind::SMin
+ : RecurKind::UMin,
+ ReducedPartRdx, State.get(getOperand(2 + Part)));
----------------
alexey-bataev wrote:
Lots of similar code, better just to preselect RecurKind
https://github.com/llvm/llvm-project/pull/140451
More information about the llvm-commits
mailing list