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

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 12:51:34 PST 2024


================
@@ -760,10 +760,12 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
   /// Estimate the overhead of scalarizing an instruction. Insert and Extract
   /// are set if the demanded result elements need to be inserted and/or
   /// extracted from vectors.
-  InstructionCost getScalarizationOverhead(VectorType *InTy,
-                                           const APInt &DemandedElts,
-                                           bool Insert, bool Extract,
-                                           TTI::TargetCostKind CostKind) {
+  InstructionCost getScalarizationOverhead(
+      VectorType *InTy, const APInt &DemandedElts, bool Insert, bool Extract,
+      TTI::TargetCostKind CostKind, ArrayRef<Value *> VL = std::nullopt) {
+    assert((VL.empty() ||
+            VL.size() == cast<FixedVectorType>(InTy)->getNumElements()) &&
----------------
alexey-bataev wrote:

Also, the size of the DemandedElts should match VL.size(), if VL is not empty

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


More information about the llvm-commits mailing list