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

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 05:53:59 PST 2025


================
@@ -8162,13 +8174,19 @@ VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(VPSingleDefRecipe *R,
           getScalingForReduction(RdxDesc.getLoopExitInstr()).value_or(1);
       PhiRecipe = new VPReductionPHIRecipe(
           Phi, RdxDesc.getRecurrenceKind(), *StartV, CM.isInLoopReduction(Phi),
-          CM.useOrderedReductions(RdxDesc), ScaleFactor);
-    } else {
+          CM.useOrderedReductions(RdxDesc), ScaleFactor,
+          RdxDesc.isPhiMultiUse());
+    } else if (Legal->isFixedOrderRecurrence(Phi)) {
----------------
ayalz wrote:

This previously last else case assumed Phi was a FOR, i.e., could have asserted?

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


More information about the llvm-commits mailing list