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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 6 23:02:20 PDT 2025


================
@@ -4459,8 +4459,13 @@ bool LoopVectorizationPlanner::isCandidateForEpilogueVectorization(
     ElementCount VF) const {
   // Cross iteration phis such as reductions need special handling and are
   // currently unsupported.
-  if (any_of(OrigLoop->getHeader()->phis(),
-             [&](PHINode &Phi) { return Legal->isFixedOrderRecurrence(&Phi); }))
+  if (any_of(OrigLoop->getHeader()->phis(), [&](PHINode &Phi) {
+        return Legal->isFixedOrderRecurrence(&Phi) ||
+               (Legal->isReductionVariable(&Phi) &&
+                Legal->getReductionVars()
+                        .find(&Phi)
+                        ->second.getRecurrenceKind() == RecurKind::FMaxNoFMFs);
----------------
arsenm wrote:

.lookup? Can you shrink this by combining the isReductionVariable + getReductionVars.find? 

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


More information about the llvm-commits mailing list