[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:54:01 PST 2025


================
@@ -8499,6 +8520,10 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
   // Adjust the recipes for any inloop reductions.
   adjustRecipesForReductions(Plan, RecipeBuilder, Range.Start);
 
+  // Try to legalize reductions with multiple in-loop uses.
+  if (!VPlanTransforms::runPass(VPlanTransforms::legalizeMultiUseReductions,
----------------
ayalz wrote:

```suggestion
  // Apply mandatory transformation to handle reductions with multiple in-loop
  // uses if possible, bail out otherwise.
  if (!VPlanTransforms::runPass(VPlanTransforms::handleMultiUseReductions,
```

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


More information about the llvm-commits mailing list