[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:13:51 PDT 2026
================
@@ -6912,12 +6895,16 @@ void VPlanTransforms::convertToStridedAccesses(VPlan &Plan,
VPBuilder Builder(LoadR);
// Create the base pointer of strided access.
VPValue *StartVPV = vputils::getOrCreateVPValueForSCEVExpr(Plan, Start);
+ const DataLayout &DL = PSE.getSE()->getDataLayout();
+ Type *IdxTy = DL.getIndexType(TypeInfo.inferScalarType(Ptr));
VPValue *StrideInBytes =
- Plan.getConstantInt(VectorLoop->getCanonicalIVType(),
- Step->getSExtValue(), /*IsSigned=*/true);
+ Plan.getConstantInt(IdxTy, Step->getSExtValue(), /*IsSigned=*/true);
auto *AddRecPtr = cast<SCEVAddRecExpr>(PtrSCEV);
+ VPValue *CanIV = Builder.createScalarZExtOrTrunc(
+ VectorLoop->getCanonicalIV(), IdxTy, VectorLoop->getCanonicalIVType(),
+ DebugLoc::getUnknown());
auto *Offset = Builder.createOverflowingOp(
- Instruction::Mul, {VectorLoop->getCanonicalIV(), StrideInBytes},
+ Instruction::Mul, {CanIV, StrideInBytes},
----------------
Mel-Chen wrote:
Sure
https://github.com/llvm/llvm-project/pull/201070
https://github.com/llvm/llvm-project/pull/199647
More information about the llvm-commits
mailing list