[llvm] LoopVectorize/X86: add test for crash in #72969 (PR #74111)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 4 08:28:21 PST 2023
https://github.com/artagnon updated https://github.com/llvm/llvm-project/pull/74111
>From 312a2752107e94bfddbcfeb2ed9d9aa6cf6cc931 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <Ramkumar.Ramachandra at imgtec.com>
Date: Fri, 1 Dec 2023 17:15:43 +0000
Subject: [PATCH] LoopVectorize/{X86,AArch64}: add test for crash in #72969
---
.../LoopVectorize/AArch64/pr72969.ll | 24 +++++++++++++++++++
.../Transforms/LoopVectorize/X86/pr72969.ll | 24 +++++++++++++++++++
2 files changed, 48 insertions(+)
create mode 100644 llvm/test/Transforms/LoopVectorize/AArch64/pr72969.ll
create mode 100644 llvm/test/Transforms/LoopVectorize/X86/pr72969.ll
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/pr72969.ll b/llvm/test/Transforms/LoopVectorize/AArch64/pr72969.ll
new file mode 100644
index 0000000000000..d83c7451c49ea
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/pr72969.ll
@@ -0,0 +1,24 @@
+; RUN: not --crash opt -mtriple=aarch64 -mattr=-sve,+neon -passes=loop-vectorize -S < %s
+
+ at h = global i32 0, align 4
+
+define void @test(ptr %p) {
+entry:
+ br label %for.body
+
+for.body:
+ %idx.ext.merge = phi i64 [ 1, %entry ], [ %idx, %for.body ]
+ %inc.merge = phi i16 [ 1, %entry ], [ %inc, %for.body ]
+ %idx.merge = phi i64 [ 0, %entry ], [ %idx.ext.merge, %for.body ]
+ %add = shl i64 %idx.merge, 1
+ %arrayidx = getelementptr [1 x i32], ptr %p, i64 0, i64 %add
+ %0 = load i32, ptr %arrayidx, align 4
+ %inc = add i16 %inc.merge, 1
+ %idx = zext i16 %inc to i64
+ %gep = getelementptr i32, ptr %p, i64 %idx
+ %cmp = icmp ugt ptr %gep, @h
+ br i1 %cmp, label %exit, label %for.body
+
+exit:
+ ret void
+}
diff --git a/llvm/test/Transforms/LoopVectorize/X86/pr72969.ll b/llvm/test/Transforms/LoopVectorize/X86/pr72969.ll
new file mode 100644
index 0000000000000..72c8b16becfc3
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/X86/pr72969.ll
@@ -0,0 +1,24 @@
+; RUN: not --crash opt -mtriple=x86_64 -mattr=-avx,-avx2,-avx512f,-sse2,-sse3,+sse -passes=loop-vectorize -S < %s
+
+ at h = global i32 0, align 4
+
+define void @test(ptr %p) {
+entry:
+ br label %for.body
+
+for.body:
+ %idx.ext.merge = phi i64 [ 1, %entry ], [ %idx, %for.body ]
+ %inc.merge = phi i16 [ 1, %entry ], [ %inc, %for.body ]
+ %idx.merge = phi i64 [ 0, %entry ], [ %idx.ext.merge, %for.body ]
+ %add = shl i64 %idx.merge, 1
+ %arrayidx = getelementptr [1 x i32], ptr %p, i64 0, i64 %add
+ %0 = load i32, ptr %arrayidx, align 4
+ %inc = add i16 %inc.merge, 1
+ %idx = zext i16 %inc to i64
+ %gep = getelementptr i32, ptr %p, i64 %idx
+ %cmp = icmp ugt ptr %gep, @h
+ br i1 %cmp, label %exit, label %for.body
+
+exit:
+ ret void
+}
More information about the llvm-commits
mailing list