[llvm] [VPlan] zext canonical IV in convertToStridedAccesses (PR #212291)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 01:27:54 PDT 2026


================
@@ -5815,7 +5815,7 @@ void VPlanTransforms::convertToStridedAccesses(VPlan &Plan,
       Type *IndexTy = Plan.getDataLayout().getIndexType(Ptr->getScalarType());
       assert(IndexTy == StrideInBytes->getScalarType() &&
              "Stride type from SCEV must match the index type");
-      VPValue *CanIV = Builder.createScalarSExtOrTrunc(
+      VPValue *CanIV = Builder.createScalarZExtOrTrunc(
----------------
fhahn wrote:

Ah yes, right.

Another thing , it looks like `sext` for the cases in `llvm/test/Transforms/LoopVectorize/RISCV/strided-accesses-narrow-iv.ll` is only correct because the narrow IV does not signed wrap. It looks like we don't vectorize with strided loads if it would wrap, but this may be something to keep an eye out for

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


More information about the llvm-commits mailing list