[llvm] [LV] Vectorize fmin/fmax reductions (PR #198300)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 6 09:56:31 PDT 2026
================
@@ -1680,6 +1682,20 @@ bool VPlanTransforms::handleMaxMinNumReductions(VPlan &Plan) {
if (MinOrMaxNumReductionsToHandle.empty())
return true;
+ // Unsupported VP reduction Phis should be handled by handleMultiUseReductions
+ // if the unsupported phi is part of a FindIV chain which qualifies,
+ // regardless if it's a min/max or minnum/maxnum reduction op.
+ bool AllUnsupportedPhisInMultiUseChain =
+ all_of(UnsupportedVPRdxPhis, [&](VPReductionPHIRecipe *R) {
+ return R->hasOneUse() && all_of(R->users(), [](VPUser *U) {
+ CmpPredicate Pred;
+ return match(U, m_Select(m_Cmp(Pred, m_VPValue(), m_VPValue()),
+ m_VPValue(), m_VPValue()));
+ });
+ });
+ if (!UnsupportedVPRdxPhis.empty() && AllUnsupportedPhisInMultiUseChain)
+ return true;
----------------
fhahn wrote:
I don't think this is correct; IIRC min/maxnum reductions need special handling due to the way they handle signaling NaN.
https://github.com/llvm/llvm-project/pull/198300
More information about the llvm-commits
mailing list