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

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 02:07:14 PDT 2026


================
@@ -7030,13 +7031,20 @@ void VPlanTransforms::convertToStridedAccesses(VPlan &Plan,
 
       VPBuilder Builder(LoadR);
       // Create the base pointer of strided access.
+      // TODO: reuse VPDerivedIVRecipe for base pointer computation when it
+      // supports a general VPValue as the start value.
       VPValue *StartVPV = vputils::getOrCreateVPValueForSCEVExpr(Plan, Start);
-      VPValue *StrideInBytes =
-          Plan.getConstantInt(VectorLoop->getCanonicalIVType(),
-                              Step->getSExtValue(), /*IsSigned=*/true);
+      VPValue *StrideInBytes = Plan.getOrAddLiveIn(Step->getValue());
+      Type *StrideTy = TypeInfo.inferScalarType(StrideInBytes);
+      assert(StrideTy == PSE.getSE()->getDataLayout().getIndexType(
----------------
Mel-Chen wrote:

e2a24f1eabbad9faab13f3cd6d36f26bf918ebc6

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


More information about the llvm-commits mailing list