[Mlir-commits] [mlir] 2920095 - [mlir][llvm] Consolidate function attribute import tests (NFC).

Tobias Gysi llvmlistbot at llvm.org
Thu Nov 17 01:31:57 PST 2022


Author: Tobias Gysi
Date: 2022-11-17T10:28:02+01:00
New Revision: 2920095d41091c1d4d73d2994a612427a6155db2

URL: https://github.com/llvm/llvm-project/commit/2920095d41091c1d4d73d2994a612427a6155db2
DIFF: https://github.com/llvm/llvm-project/commit/2920095d41091c1d4d73d2994a612427a6155db2.diff

LOG: [mlir][llvm] Consolidate function attribute import tests (NFC).

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

Added: 
    mlir/test/Target/LLVMIR/Import/function-attributes.ll

Modified: 
    mlir/test/Target/LLVMIR/Import/basic.ll

Removed: 
    mlir/test/Target/LLVMIR/Import/func-attrs.ll
    mlir/test/Target/LLVMIR/Import/function_attributes.ll


################################################################################
diff  --git a/mlir/test/Target/LLVMIR/Import/basic.ll b/mlir/test/Target/LLVMIR/Import/basic.ll
index 32a7795757d00..8318ff45c49d6 100644
--- a/mlir/test/Target/LLVMIR/Import/basic.ll
+++ b/mlir/test/Target/LLVMIR/Import/basic.ll
@@ -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
index 4008f12780d5c..0000000000000
--- a/mlir/test/Target/LLVMIR/Import/func-attrs.ll
+++ /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
index 0000000000000..622cc20486684
--- /dev/null
+++ b/mlir/test/Target/LLVMIR/Import/function-attributes.ll
@@ -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
index 8588b88a96657..0000000000000
--- a/mlir/test/Target/LLVMIR/Import/function_attributes.ll
+++ /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
-}


        


More information about the Mlir-commits mailing list