[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:34 PDT 2024


================
@@ -17939,9 +17956,23 @@ class HorizontalReduction {
     case RecurKind::FAdd:
     case RecurKind::FMul: {
       unsigned RdxOpcode = RecurrenceDescriptor::getOpcode(RdxKind);
-      if (!AllConsts)
-        VectorCost =
-            TTI->getArithmeticReductionCost(RdxOpcode, VectorTy, FMF, CostKind);
+      if (!AllConsts) {
+        if (auto *VecTy = dyn_cast<FixedVectorType>(ScalarTy)) {
+          assert(SLPReVec && "FixedVectorType is not expected.");
+          unsigned ScalarTyNumElements = VecTy->getNumElements();
+          for (unsigned I = 0, End = ReducedVals.size(); I != End; ++I) {
----------------
alexey-bataev wrote:

`for (unsigned I : seq<unsigned>(ReducedVals.size()))`

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


More information about the llvm-commits mailing list