[llvm] [SLP][REVEC] Make tryToReduce and related functions support vector instructions. (PR #102327)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 09:29:36 PDT 2024


================
@@ -17710,8 +17710,25 @@ class HorizontalReduction {
                                          SameValuesCounter, TrackedToOrig);
         }
 
-        Value *ReducedSubTree =
-            emitReduction(VectorizedRoot, Builder, ReduxWidth, TTI);
+        Value *ReducedSubTree;
+        Type *ScalarTy = VL.front()->getType();
+        if (isa<FixedVectorType>(ScalarTy)) {
+          assert(SLPReVec && "FixedVectorType is not expected.");
+          unsigned ScalarTyNumElements = getNumElements(ScalarTy);
+          ReducedSubTree = PoisonValue::get(FixedVectorType::get(
+              VectorizedRoot->getType()->getScalarType(), ScalarTyNumElements));
+          for (unsigned I = 0; I != ScalarTyNumElements; ++I) {
----------------
alexey-bataev wrote:

`for (unsigned I : seq<unsigned>(ScalarTyNumElements))`

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


More information about the llvm-commits mailing list