diff options
| author | Mel Chen <mel.chen@sifive.com> | 2025-11-14 17:14:07 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-14 09:14:07 +0000 |
| commit | 3277f6caef110359046e32983fee37932b8f9ac2 (patch) | |
| tree | edcb22d305d6be9445595110aeeb2cadcdfc7032 /llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | |
| parent | bf07226c6d6aaf3b8f230e4e36e8aac8e40d8c4d (diff) | |
[LV] Explicitly disable in-loop reductions for AnyOf and FindIV. nfc (#163541)
Currently, in-loop reductions for AnyOf and FindIV are not supported.
They were implicitly blocked. This happened because
RecurrenceDescriptor::getReductionOpChain could not detect their
recurrence chain. The reason is that RecurrenceDescriptor::getOpcode was
set to Instruction::Or, but the recurrence chains of AnyOf and FindIV do
not actually contain an Instruction::Or.
This patch explicitly disables in-loop reductions for AnyOf and FindIV
instead of relying on getReductionOpChain to implicitly prevent them.
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 9f0d6fcb237e..58fcab40d589 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -6591,9 +6591,14 @@ void LoopVectorizationCostModel::collectInLoopReductions() { if (RdxDesc.getRecurrenceType() != Phi->getType()) continue; + // In-loop AnyOf and FindIV reductions are not yet supported. + RecurKind Kind = RdxDesc.getRecurrenceKind(); + if (RecurrenceDescriptor::isAnyOfRecurrenceKind(Kind) || + RecurrenceDescriptor::isFindIVRecurrenceKind(Kind)) + continue; + // If the target would prefer this reduction to happen "in-loop", then we // want to record it as such. - RecurKind Kind = RdxDesc.getRecurrenceKind(); if (!PreferInLoopReductions && !useOrderedReductions(RdxDesc) && !TTI.preferInLoopReduction(Kind, Phi->getType())) continue; |
