[llvm] [SystemZ] SLP reductions: cost functions of reductions and scalarization (PR #112491)

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 08:31:18 PDT 2024


================
@@ -12897,7 +12897,15 @@ InstructionCost BoUpSLP::getGatherCost(ArrayRef<Value *> VL, bool ForPoisonSrc,
               TTI::SK_InsertSubvector, VecTy, std::nullopt, CostKind,
               I * ScalarTyNumElements, cast<FixedVectorType>(ScalarTy));
     } else {
-      Cost = TTI->getScalarizationOverhead(VecTy, ~ShuffledElements,
+      // Add insertion costs for all elements, but not for loads that can be
+      // loaded directly into a vector element for free.
+      APInt FreeEltLoads = APInt::getZero(VL.size());
+      if (TTI->supportsEfficientVectorElementLoadStore())
+        for (unsigned I = 0, E = VL.size(); I < E; ++I)
----------------
JonPsson1 wrote:

fixed - thanks. Does this change to SLPVectorizer.cpp now look ok?

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


More information about the llvm-commits mailing list