[llvm] [LV] Convert scatter stores with constant stride into strided stores (PR #206896)

Andrei Elovikov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 17:54:15 PDT 2026


================
@@ -2367,10 +2371,13 @@ InstructionCost VPWidenMemIntrinsicRecipe::computeMemIntrinsicCost(
 InstructionCost
 VPWidenMemIntrinsicRecipe::computeCost(ElementCount VF,
                                        VPCostContext &Ctx) const {
-  Type *Ty = toVectorTy(getScalarType(), VF);
-  return computeMemIntrinsicCost(getVectorIntrinsicID(), Ty,
-                                 !match(getOperand(2), m_True()), Alignment,
-                                 Ctx);
+  Type *DataTy = getScalarType();
+  if (DataTy->isVoidTy())
+    DataTy = getOperand(0)->getScalarType();
+  Type *Ty = toVectorTy(DataTy, VF);
+  return computeMemIntrinsicCost(
+      getVectorIntrinsicID(), Ty,
+      !match(getOperand(getNumOperands() - 2), m_True()), Alignment, Ctx);
----------------
eas wrote:

Does this "-2" rely on the assert for the intrinsic ID from the ctor? If so, isn't that too fragile?

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


More information about the llvm-commits mailing list