[llvm] [SLP][Revec] Fix SLP crash when trying to fold trailing scalars into the reduced value (PR #203477)
Sushant Gokhale via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 20 21:14:50 PDT 2026
================
@@ -30442,11 +30433,8 @@ class HorizontalReduction {
// Emit ordered reduction for the vectorized window.
Builder.SetCurrentDebugLocation(
cast<Instruction>(ReductionRoot)->getDebugLoc());
- if (VectorizedTree)
- VectorizedTree =
- emitReduction(SuccessRoot, Builder, TTI, DestTy, VectorizedTree);
- else
- VectorizedTree = emitReduction(SuccessRoot, Builder, TTI, DestTy);
+ VectorizedTree = createSingleOp(Builder, *TTI, SuccessRoot, 1, false,
----------------
sushgokh wrote:
> Add the assertion and comment, please
```
/// Attempt to vectorize an ordered (linearized) reduction chain.
/// Reduced values from matchOrderedReduction() are in accumulation order.
/// Vectorized subsets are immediately reduced via ordered reduction
/// intrinsics; non-vectorized values are folded linearly.
Value *tryToReduceOrdered(BoUpSLP &V, const DataLayout &DL,
TargetTransformInfo *TTI,
const TargetLibraryInfo &TLI, AssumptionCache *AC,
DominatorTree &DT) {
```
`matchOrderedReduction()` already checks if this is `FAdd`. Can we skip comment and assert ?
https://github.com/llvm/llvm-project/pull/203477
More information about the llvm-commits
mailing list