[llvm] [VPlan] Use pointer index type for stride in convertToStridedAccesses (PR #199647)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 2 02:20:06 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(
----------------
lukel97 wrote:
Nit with naming, CastedStride sounds a bit funny, maybe name it something like `CanIVTyStride`?
https://github.com/llvm/llvm-project/pull/199647
More information about the llvm-commits
mailing list