[llvm] [LV][RISCV] Add crash test for wide pointer stride in convertToStridedAccesses (PR #200985)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 1 23:09:37 PDT 2026
https://github.com/Michael-Chen-NJU updated https://github.com/llvm/llvm-project/pull/200985
>From 72141486833744d416d678bae46b107e7a16dbde Mon Sep 17 00:00:00 2001
From: Michael-Chen-NJU <221250121 at smail.nju.edu.cn>
Date: Tue, 2 Jun 2026 09:57:09 +0800
Subject: [PATCH] [LV][RISCV] Add crash test for wide pointer stride in
convertToStridedAccesses
Pre-commit test for https://github.com/llvm/llvm-project/issues/199640.
The test demonstrates a crash when the pointer stride exceeds the
canonical IV type (i32) range. To be updated by #199647.
---
.../RISCV/strided-access-wide-stride.ll | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 llvm/test/Transforms/LoopVectorize/RISCV/strided-access-wide-stride.ll
diff --git a/llvm/test/Transforms/LoopVectorize/RISCV/strided-access-wide-stride.ll b/llvm/test/Transforms/LoopVectorize/RISCV/strided-access-wide-stride.ll
new file mode 100644
index 0000000000000..4490b5bceb14f
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/RISCV/strided-access-wide-stride.ll
@@ -0,0 +1,26 @@
+; RUN: not --crash opt < %s -passes=loop-vectorize -mtriple=riscv64 -mattr=+v,+zvl256b -S 2>&1 | FileCheck %s
+; CHECK: isIntN
+
+; Test for https://github.com/llvm/llvm-project/issues/199640
+; convertToStridedAccesses uses the canonical IV type (i32) for the stride
+; constant, but the pointer stride exceeds INT32_MAX on rv64 with a narrow IV.
+
+define void @stride_exceeds_i32_max(ptr noalias readonly %src, ptr noalias %dst, i16 %start) {
+entry:
+ %tobool = icmp eq i16 %start, 0
+ br i1 %tobool, label %exit, label %loop
+
+loop:
+ %e = phi i16 [ %start, %entry ], [ %e.next, %loop ]
+ %e.ext = sext i16 %e to i64
+ %offset = mul nsw i64 %e.ext, 3000000000
+ %gep = getelementptr i8, ptr %src, i64 %offset
+ %val = load i8, ptr %gep, align 1
+ store i8 %val, ptr %dst, align 1
+ %e.next = add i16 %e, 1
+ %cmp = icmp ne i16 %e.next, 0
+ br i1 %cmp, label %loop, label %exit
+
+exit:
+ ret void
+}
More information about the llvm-commits
mailing list