[llvm] 2c174a5 - [LoongArch] Move illegal ImmArg tests to llvm/test/Verifier
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 6 20:27:38 PST 2023
Author: gonglingqin
Date: 2023-01-07T12:10:13+08:00
New Revision: 2c174a53d50bff301234c08d9ba130e1f0d22e28
URL: https://github.com/llvm/llvm-project/commit/2c174a53d50bff301234c08d9ba130e1f0d22e28
DIFF: https://github.com/llvm/llvm-project/commit/2c174a53d50bff301234c08d9ba130e1f0d22e28.diff
LOG: [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 https://github.com/llvm/llvm-project/issues/59839
Added:
llvm/test/CodeGen/LoongArch/returnaddr-error.ll
llvm/test/Verifier/LoongArch/intrinsic-immarg.ll
llvm/test/Verifier/LoongArch/lit.local.cfg
Modified:
llvm/test/CodeGen/LoongArch/intrinsic-la32-error.ll
Removed:
llvm/test/CodeGen/LoongArch/frameaddr-returnaddr-error.ll
################################################################################
diff --git a/llvm/test/CodeGen/LoongArch/frameaddr-returnaddr-error.ll b/llvm/test/CodeGen/LoongArch/frameaddr-returnaddr-error.ll
deleted file mode 100644
index 10fcdf2004b4..000000000000
--- a/llvm/test/CodeGen/LoongArch/frameaddr-returnaddr-error.ll
+++ /dev/null
@@ -1,24 +0,0 @@
-; RUN: not llc --mtriple=loongarch64 --disable-verify < %s 2>&1 | FileCheck %s
-
-declare ptr @llvm.frameaddress(i32)
-declare ptr @llvm.returnaddress(i32)
-
-define ptr @non_const_depth_frameaddress(i32 %x) nounwind {
-; CHECK: argument to '__builtin_frame_address' must be a constant integer
- %1 = call ptr @llvm.frameaddress(i32 %x)
- ret ptr %1
-}
-
-
-define ptr @non_const_depth_returnaddress(i32 %x) nounwind {
-; CHECK: argument to '__builtin_return_address' must be a constant integer
- %1 = call ptr @llvm.returnaddress(i32 %x)
- ret ptr %1
-}
-
-define ptr @non_zero_returnaddress() nounwind {
-; CHECK: return address can only be determined for the current frame
- %1 = call ptr @llvm.returnaddress(i32 1)
- ret ptr %1
-}
-
diff --git a/llvm/test/CodeGen/LoongArch/intrinsic-la32-error.ll b/llvm/test/CodeGen/LoongArch/intrinsic-la32-error.ll
index 4b38e6ca1090..c91516149b6d 100644
--- a/llvm/test/CodeGen/LoongArch/intrinsic-la32-error.ll
+++ b/llvm/test/CodeGen/LoongArch/intrinsic-la32-error.ll
@@ -1,4 +1,4 @@
-; RUN: not llc --mtriple=loongarch32 --disable-verify < %s 2>&1 | FileCheck %s
+; RUN: not llc --mtriple=loongarch32 < %s 2>&1 | FileCheck %s
declare void @llvm.loongarch.cacop.w(i32, i32, i32)
declare i32 @llvm.loongarch.crc.w.b.w(i32, i32)
@@ -16,8 +16,8 @@ declare i64 @llvm.loongarch.iocsrrd.d(i32)
declare void @llvm.loongarch.iocsrwr.d(i64, i32)
declare void @llvm.loongarch.asrtle.d(i64, i64)
declare void @llvm.loongarch.asrtgt.d(i64, i64)
-declare i64 @llvm.loongarch.lddir.d(i64, i32)
-declare void @llvm.loongarch.ldpte.d(i64, i32)
+declare i64 @llvm.loongarch.lddir.d(i64, i64 immarg)
+declare void @llvm.loongarch.ldpte.d(i64, i64 immarg)
define void @cacop_arg0_out_of_hi_range(i32 %a) nounwind {
; CHECK: argument to 'llvm.loongarch.cacop.w' out of range
@@ -155,13 +155,13 @@ entry:
define i64 @lddir_d(i64 %a) {
; CHECK: llvm.loongarch.lddir.d requires target: loongarch64
entry:
- %0 = tail call i64 @llvm.loongarch.lddir.d(i64 %a, i32 1)
+ %0 = tail call i64 @llvm.loongarch.lddir.d(i64 %a, i64 1)
ret i64 %0
}
define void @ldpte_d(i64 %a) {
; CHECK: llvm.loongarch.ldpte.d requires target: loongarch64
entry:
- tail call void @llvm.loongarch.ldpte.d(i64 %a, i32 1)
+ tail call void @llvm.loongarch.ldpte.d(i64 %a, i64 1)
ret void
}
diff --git a/llvm/test/CodeGen/LoongArch/returnaddr-error.ll b/llvm/test/CodeGen/LoongArch/returnaddr-error.ll
new file mode 100644
index 000000000000..6ac1e0afcd5c
--- /dev/null
+++ b/llvm/test/CodeGen/LoongArch/returnaddr-error.ll
@@ -0,0 +1,9 @@
+; RUN: not llc --mtriple=loongarch64 < %s 2>&1 | FileCheck %s
+
+declare ptr @llvm.returnaddress(i32 immarg)
+
+define ptr @non_zero_returnaddress() nounwind {
+; CHECK: return address can only be determined for the current frame
+ %1 = call ptr @llvm.returnaddress(i32 1)
+ ret ptr %1
+}
diff --git a/llvm/test/Verifier/LoongArch/intrinsic-immarg.ll b/llvm/test/Verifier/LoongArch/intrinsic-immarg.ll
new file mode 100644
index 000000000000..488f77ff55ed
--- /dev/null
+++ b/llvm/test/Verifier/LoongArch/intrinsic-immarg.ll
@@ -0,0 +1,20 @@
+; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+
+declare ptr @llvm.frameaddress(i32 immarg)
+declare ptr @llvm.returnaddress(i32 immarg)
+
+define ptr @non_const_depth_frameaddress(i32 %x) nounwind {
+ ; CHECK: immarg operand has non-immediate parameter
+ ; CHECK-NEXT: i32 %x
+ ; CHECK-NEXT: %1 = call ptr @llvm.frameaddress.p0(i32 %x)
+ %1 = call ptr @llvm.frameaddress(i32 %x)
+ ret ptr %1
+}
+
+define ptr @non_const_depth_returnaddress(i32 %x) nounwind {
+ ; CHECK: immarg operand has non-immediate parameter
+ ; CHECK-NEXT: i32 %x
+ ; CHECK-NEXT: %1 = call ptr @llvm.returnaddress(i32 %x)
+ %1 = call ptr @llvm.returnaddress(i32 %x)
+ ret ptr %1
+}
diff --git a/llvm/test/Verifier/LoongArch/lit.local.cfg b/llvm/test/Verifier/LoongArch/lit.local.cfg
new file mode 100644
index 000000000000..2b5a4893e686
--- /dev/null
+++ b/llvm/test/Verifier/LoongArch/lit.local.cfg
@@ -0,0 +1,2 @@
+if not 'LoongArch' in config.root.targets:
+ config.unsupported = True
More information about the llvm-commits
mailing list