[llvm] [LV] Vectorize fmin/fmax reductions (PR #198300)
John Brawn via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 9 08:17:19 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;
----------------
john-brawn-arm wrote:
I was just commenting on the apparent contradiction between what the PR title and what was in the test. I don't know enough about the semantics of the various kinds for fp min/max to have an opinion on whether we should be vectorizing or not.
https://github.com/llvm/llvm-project/pull/198300
More information about the llvm-commits
mailing list