xref: /llvm-project/llvm/test/CodeGen/LoongArch/ldx-stx-sp-2.ll (revision 9d4f7f44b64d87d1068859906f43b7ce03a7388b)
1; RUN: llc --mtriple=loongarch32 -mattr=+d < %s
2; RUN: llc --mtriple=loongarch64 -mattr=+d < %s
3
4;; This should not crash the code generator.
5
6@.str.2 = external dso_local unnamed_addr constant [69 x i8], align 1
7
8define dso_local void @main() {
9entry:
10  %n0 = alloca [2 x [3 x i32]], align 4
11  %0 = load i32, ptr poison, align 4
12  %idxprom15 = sext i32 %0 to i64
13  %arrayidx16 = getelementptr inbounds [2 x [3 x i32]], ptr %n0, i64 0, i64 %idxprom15
14  %arrayidx17 = getelementptr inbounds [3 x i32], ptr %arrayidx16, i64 0, i64 0
15  %1 = load i32, ptr %arrayidx17, align 4
16  call void (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef signext %1)
17  ret void
18}
19
20declare void @printf(ptr, ...)
21