[mlir][llvm] Consolidate function attribute import tests (NFC).
authorTobias Gysi <tobias.gysi@nextsilicon.com>
Thu, 17 Nov 2022 09:27:43 +0000 (10:27 +0100)
committerTobias Gysi <tobias.gysi@nextsilicon.com>
Thu, 17 Nov 2022 09:28:02 +0000 (10:28 +0100)
The revision puts the function attributes tests previously distributed
accross multiple files int a single function-attributes.ll test file.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D137627

mlir/test/Target/LLVMIR/Import/basic.ll
mlir/test/Target/LLVMIR/Import/func-attrs.ll [deleted file]
mlir/test/Target/LLVMIR/Import/function-attributes.ll [new file with mode: 0644]
mlir/test/Target/LLVMIR/Import/function_attributes.ll [deleted file]

index 32a7795..8318ff4 100644 (file)
@@ -5,23 +5,9 @@
 
 @global = external global double, align 8
 
-;
-; Linkage on functions.
-;
-
-; CHECK: llvm.func internal @func_internal
-define internal void @func_internal() {
-  ret void
-}
-
 ; CHECK: llvm.func @fe(i32) -> f32
 declare float @fe(i32)
 
-; CHECK: llvm.func internal spir_funccc @spir_func_internal()
-define internal spir_func void @spir_func_internal() {
-  ret void
-}
-
 ; FIXME: function attributes.
 ; CHECK-LABEL: llvm.func internal @f1(%arg0: i64) -> i32 attributes {dso_local} {
 ; CHECK-DBG: llvm.func internal @f1(%arg0: i64 loc(unknown)) -> i32 attributes {dso_local} {
diff --git a/mlir/test/Target/LLVMIR/Import/func-attrs.ll b/mlir/test/Target/LLVMIR/Import/func-attrs.ll
deleted file mode 100644 (file)
index 4008f12..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-; RUN: mlir-translate -import-llvm %s | FileCheck %s
-
-; CHECK: llvm.func @foo(%arg0: !llvm.ptr {llvm.byval = i64}, %arg1: !llvm.ptr {llvm.byref = i64}, %arg2: !llvm.ptr {llvm.sret = i64}, %arg3: !llvm.ptr {llvm.inalloca = i64})
-define void @foo(ptr byval(i64) %arg0, ptr byref(i64) %arg1, ptr sret(i64) %arg2, ptr inalloca(i64) %arg3) {
-  ret void
-}
diff --git a/mlir/test/Target/LLVMIR/Import/function-attributes.ll b/mlir/test/Target/LLVMIR/Import/function-attributes.ll
new file mode 100644 (file)
index 0000000..622cc20
--- /dev/null
@@ -0,0 +1,40 @@
+; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s
+
+; CHECK: llvm.func internal @func_internal
+define internal void @func_internal() {
+  ret void
+}
+
+; CHECK: llvm.func internal spir_funccc @spir_func_internal()
+define internal spir_func void @spir_func_internal() {
+  ret void
+}
+
+; // -----
+
+; CHECK-LABEL: @func_readnone
+; CHECK-SAME:  attributes {llvm.readnone}
+; CHECK:   llvm.return
+define void @func_readnone() readnone {
+  ret void
+}
+
+; CHECK-LABEL: @func_readnone_indirect
+; CHECK-SAME:  attributes {llvm.readnone}
+declare void @func_readnone_indirect() #0
+attributes #0 = { readnone }
+
+; // -----
+
+; CHECK-LABEL: @func_arg_attrs
+; CHECK-SAME:  !llvm.ptr {llvm.byval = i64}
+; CHECK-SAME:  !llvm.ptr {llvm.byref = i64}
+; CHECK-SAME:  !llvm.ptr {llvm.sret = i64}
+; CHECK-SAME:  !llvm.ptr {llvm.inalloca = i64}
+define void @func_arg_attrs(
+    ptr byval(i64) %arg0,
+    ptr byref(i64) %arg1,
+    ptr sret(i64) %arg2,
+    ptr inalloca(i64) %arg3) {
+  ret void
+}
diff --git a/mlir/test/Target/LLVMIR/Import/function_attributes.ll b/mlir/test/Target/LLVMIR/Import/function_attributes.ll
deleted file mode 100644 (file)
index 8588b88..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s
-
-// -----
-
-; CHECK: llvm.func @readnone_attr() attributes {llvm.readnone}
-declare void @readnone_attr() #0
-attributes #0 = { readnone }
-
-// -----
-
-; CHECK: llvm.func @readnone_attr() attributes {llvm.readnone} {
-; CHECK:   llvm.return
-; CHECK: }
-define void @readnone_attr() readnone {
-entry:
-  ret void
-}