[llvm] [LV] Support argmin/argmax with strict predicates. (PR #170223)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 13 04:47:19 PST 2026
================
@@ -1454,12 +1461,7 @@ static bool handleFirstArgMinOrMax(
"FindIV reduction must not be scaled");
VPValue *MaxIV =
Plan.getConstantInt(APInt::getMaxValue(Ty->getIntegerBitWidth()));
- ReductionStyle Style = RdxUnordered{1};
- auto *FirstIdxPhiR = new VPReductionPHIRecipe(
- dyn_cast_or_null<PHINode>(FindLastIVPhiR->getUnderlyingValue()),
- RecurKind::UMin, *MaxIV, *FindIVSelectR, Style,
- FindLastIVPhiR->hasUsesOutsideReductionChain());
- FirstIdxPhiR->insertBefore(FindLastIVPhiR);
+ FindLastIVPhiR->setOperand(0, MaxIV);
----------------
ayalz wrote:
Re: using poison instead of MaxUInt - a `select` should prevent poison from propagating? If overall min/max was set in some iteration, then all lanes resulting in other min/max should have their index replaced by MaxUInt before reducing, including all poison indices - whose resulting min/max is the initial extremal value. Otherwise, all indices are poison, and its reduced result (poison?) should be replaced by select'ing the original default index instead?
https://github.com/llvm/llvm-project/pull/170223
More information about the llvm-commits
mailing list