[llvm] [LV] Vectorize FMax via OrderedFCmpSelect w/o fast-math flags. (PR #146711)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 6 10:06:30 PDT 2025


================
@@ -654,7 +654,105 @@ void VPlanTransforms::attachCheckBlock(VPlan &Plan, Value *Cond,
   }
 }
 
-bool VPlanTransforms::handleMaxMinNumReductions(VPlan &Plan) {
+static bool handleOrderedFCmpSelect(VPlan &Plan,
+                                    VPReductionPHIRecipe *RedPhiR) {
+  VPRegionBlock *LoopRegion = Plan.getVectorLoopRegion();
+  VPWidenIntOrFpInductionRecipe *WideIV = nullptr;
+
+  // MaxOp feeding the reduction phi must be a select (either wide or a
+  // replicate recipe), where the phi is the last operand, and the compare
+  // predicate is strict. This ensures NaNs won't get propagated unless the
+  // initial value is NaN
----------------
ayalz wrote:

```suggestion
  // initial value is NaN.
```

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


More information about the llvm-commits mailing list