[llvm] [SLP][Revec] Fix SLP crash when trying to fold trailing scalars into the reduced value (PR #203477)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 20 19:38:25 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,
----------------
alexey-bataev wrote:

Add the assertion and comment, please

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


More information about the llvm-commits mailing list