[llvm] [VPlan] Use pointer index type for stride in convertToStridedAccesses (PR #199647)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 2 02:56:49 PDT 2026


================
@@ -7088,12 +7089,17 @@ void VPlanTransforms::convertToStridedAccesses(VPlan &Plan,
       VPBuilder Builder(LoadR);
       // Create the base pointer of strided access.
       VPValue *StartVPV = vputils::getOrCreateVPValueForSCEVExpr(Plan, Start);
-      VPValue *StrideInBytes =
-          Plan.getConstantInt(VectorLoop->getCanonicalIVType(),
-                              Step->getSExtValue(), /*IsSigned=*/true);
+      VPValue *StrideInBytes = Plan.getOrAddLiveIn(Step->getValue());
+      Type *IndexTy =
+          Plan.getDataLayout().getIndexType(TypeInfo.inferScalarType(Ptr));
+      assert(IndexTy == TypeInfo.inferScalarType(StrideInBytes) &&
+             "Stride type from SCEV must match the index type");
+      VPValue *CastedStride = Builder.createScalarSExtOrTrunc(
----------------
Mel-Chen wrote:

Updated

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


More information about the llvm-commits mailing list