[llvm] [LV] Vectorize maxnum/minnum w/o fast-math flags. (PR #148239)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 18 02:28:37 PDT 2025
================
@@ -4345,10 +4345,16 @@ VectorizationFactor LoopVectorizationPlanner::selectVectorizationFactor() {
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); }))
+ // Cross iteration phis such as first-order recurrences and FMaxNum/FMinNum
+ // reductions need special handling and are currently unsupported.
+ if (any_of(OrigLoop->getHeader()->phis(), [&](PHINode &Phi) {
+ if (Legal->isReductionVariable(&Phi)) {
+ RecurKind RK =
+ Legal->getRecurrenceDescriptor(&Phi).getRecurrenceKind();
+ return RK == RecurKind::FMinNum || RK == RecurKind::FMaxNum;
+ }
+ return Legal->isFixedOrderRecurrence(&Phi);
----------------
fhahn wrote:
Updated, thanks
https://github.com/llvm/llvm-project/pull/148239
More information about the llvm-commits
mailing list