[llvm] [LV] Vectorize selecting last IV of min/max element. (PR #141431)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 09:01:49 PST 2025


================
@@ -933,7 +933,8 @@ bool VPlanTransforms::handleMaxMinNumReductions(VPlan &Plan) {
 
     // If we exit early due to NaNs, compute the final reduction result based on
     // the reduction phi at the beginning of the last vector iteration.
-    auto *RdxResult = findComputeReductionResult(RedPhiR);
+    auto *RdxResult =
+        findReductionUser(RedPhiR, VPInstruction::ComputeReductionResult);
----------------
ayalz wrote:

Selecting both indices sounds like another good test, I was referring to minnum/maxnum support with early exit due to NaNs dealt with here, which stays outside this support for argmin/argmax (right?), and patched here due to its use of findComputeReductionResult().

https://github.com/llvm/llvm-project/pull/141431


More information about the llvm-commits mailing list