[llvm] [LV] Vectorize maxnum/minnum w/o fast-math flags. (PR #148239)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 17 02:33:34 PDT 2025


================
@@ -628,3 +628,140 @@ void VPlanTransforms::attachCheckBlock(VPlan &Plan, Value *Cond,
     Term->addMetadata(LLVMContext::MD_prof, BranchWeights);
   }
 }
+
+static VPValue *getMinMaxCompareValue(VPSingleDefRecipe *MinMaxOp,
+                                      VPReductionPHIRecipe *RedPhi) {
+  auto *RepR = dyn_cast<VPReplicateRecipe>(MinMaxOp);
+  if (!isa<VPWidenIntrinsicRecipe>(MinMaxOp) &&
+      !(RepR && (isa<IntrinsicInst>(RepR->getUnderlyingInstr()))))
+    return nullptr;
+
+  if (MinMaxOp->getOperand(0) == RedPhi)
+    return MinMaxOp->getOperand(1);
+  return MinMaxOp->getOperand(0);
----------------
fhahn wrote:

Done thanks

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


More information about the llvm-commits mailing list