Skip to content

Commit 2c174a5

Browse files
committed
[LoongArch] Move illegal ImmArg tests to llvm/test/Verifier
This patch also fixes incorrect function declarations in test cases and remove -disable-verify from the test case. Fix llvm#59839
1 parent 1758a6e commit 2c174a5

File tree

5 files changed

+36
-29
lines changed

5 files changed

+36
-29
lines changed

llvm/test/CodeGen/LoongArch/frameaddr-returnaddr-error.ll

Lines changed: 0 additions & 24 deletions
This file was deleted.

llvm/test/CodeGen/LoongArch/intrinsic-la32-error.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not llc --mtriple=loongarch32 --disable-verify < %s 2>&1 | FileCheck %s
1+
; RUN: not llc --mtriple=loongarch32 < %s 2>&1 | FileCheck %s
22

33
declare void @llvm.loongarch.cacop.w(i32, i32, i32)
44
declare i32 @llvm.loongarch.crc.w.b.w(i32, i32)
@@ -16,8 +16,8 @@ declare i64 @llvm.loongarch.iocsrrd.d(i32)
1616
declare void @llvm.loongarch.iocsrwr.d(i64, i32)
1717
declare void @llvm.loongarch.asrtle.d(i64, i64)
1818
declare void @llvm.loongarch.asrtgt.d(i64, i64)
19-
declare i64 @llvm.loongarch.lddir.d(i64, i32)
20-
declare void @llvm.loongarch.ldpte.d(i64, i32)
19+
declare i64 @llvm.loongarch.lddir.d(i64, i64 immarg)
20+
declare void @llvm.loongarch.ldpte.d(i64, i64 immarg)
2121

2222
define void @cacop_arg0_out_of_hi_range(i32 %a) nounwind {
2323
; CHECK: argument to 'llvm.loongarch.cacop.w' out of range
@@ -155,13 +155,13 @@ entry:
155155
define i64 @lddir_d(i64 %a) {
156156
; CHECK: llvm.loongarch.lddir.d requires target: loongarch64
157157
entry:
158-
%0 = tail call i64 @llvm.loongarch.lddir.d(i64 %a, i32 1)
158+
%0 = tail call i64 @llvm.loongarch.lddir.d(i64 %a, i64 1)
159159
ret i64 %0
160160
}
161161

162162
define void @ldpte_d(i64 %a) {
163163
; CHECK: llvm.loongarch.ldpte.d requires target: loongarch64
164164
entry:
165-
tail call void @llvm.loongarch.ldpte.d(i64 %a, i32 1)
165+
tail call void @llvm.loongarch.ldpte.d(i64 %a, i64 1)
166166
ret void
167167
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
; RUN: not llc --mtriple=loongarch64 < %s 2>&1 | FileCheck %s
2+
3+
declare ptr @llvm.returnaddress(i32 immarg)
4+
5+
define ptr @non_zero_returnaddress() nounwind {
6+
; CHECK: return address can only be determined for the current frame
7+
%1 = call ptr @llvm.returnaddress(i32 1)
8+
ret ptr %1
9+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
2+
3+
declare ptr @llvm.frameaddress(i32 immarg)
4+
declare ptr @llvm.returnaddress(i32 immarg)
5+
6+
define ptr @non_const_depth_frameaddress(i32 %x) nounwind {
7+
; CHECK: immarg operand has non-immediate parameter
8+
; CHECK-NEXT: i32 %x
9+
; CHECK-NEXT: %1 = call ptr @llvm.frameaddress.p0(i32 %x)
10+
%1 = call ptr @llvm.frameaddress(i32 %x)
11+
ret ptr %1
12+
}
13+
14+
define ptr @non_const_depth_returnaddress(i32 %x) nounwind {
15+
; CHECK: immarg operand has non-immediate parameter
16+
; CHECK-NEXT: i32 %x
17+
; CHECK-NEXT: %1 = call ptr @llvm.returnaddress(i32 %x)
18+
%1 = call ptr @llvm.returnaddress(i32 %x)
19+
ret ptr %1
20+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
if not 'LoongArch' in config.root.targets:
2+
config.unsupported = True

0 commit comments

Comments
 (0)