summaryrefslogtreecommitdiffstats
path: root/mlir/test/Conversion
diff options
context:
space:
mode:
authorAlex Zinenko <zinenko@google.com>2019-12-16 05:16:35 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-12-16 05:17:14 -0800
commit0684aa9a8bcb9823ccf3f55d4e180d8a4df13201 (patch)
treeb990b4286d45f25352ba30fba500e56596a3bdc6 /mlir/test/Conversion
parent44fc7d72b3cb44147394e22f1f21ad36cca7bca8 (diff)
downloadbcm5719-llvm-0684aa9a8bcb9823ccf3f55d4e180d8a4df13201.tar.gz
bcm5719-llvm-0684aa9a8bcb9823ccf3f55d4e180d8a4df13201.zip
Make memref promotion during std->LLVM lowering the default calling convention
During the conversion from the standard dialect to the LLVM dialect, memref-typed arguments are promoted from registers to memory and passed into functions by pointer. This had been introduced into the lowering to work around the abesnce of calling convention modeling in MLIR to enable better interoperability with LLVM IR generated from C, and has been exerciced for several months. Make this promotion the default calling covention when converting to the LLVM dialect. This adds the documentation, simplifies the code and makes the conversion consistent across function operations and function types used in other places, e.g. in high-order functions or attributes, which would not follow the same rule previously. PiperOrigin-RevId: 285751280
Diffstat (limited to 'mlir/test/Conversion')
-rw-r--r--mlir/test/Conversion/StandardToLLVM/convert-funcs.mlir8
1 files changed, 8 insertions, 0 deletions
diff --git a/mlir/test/Conversion/StandardToLLVM/convert-funcs.mlir b/mlir/test/Conversion/StandardToLLVM/convert-funcs.mlir
index 3748c0fd668..9984f8c3766 100644
--- a/mlir/test/Conversion/StandardToLLVM/convert-funcs.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/convert-funcs.mlir
@@ -18,6 +18,14 @@ func @fifth_order_left(%arg0: (((() -> ()) -> ()) -> ()) -> ())
//CHECK: llvm.func @fifth_order_right(!llvm<"void ()* ()* ()* ()*">)
func @fifth_order_right(%arg0: () -> (() -> (() -> (() -> ()))))
+// Check that memrefs are converted to pointers-to-struct if appear as function arguments.
+// CHECK: llvm.func @memref_call_conv(!llvm<"{ float*, float*, i64, [1 x i64], [1 x i64] }*">)
+func @memref_call_conv(%arg0: memref<?xf32>)
+
+// Same in nested functions.
+// CHECK: llvm.func @memref_call_conv_nested(!llvm<"void ({ float*, float*, i64, [1 x i64], [1 x i64] }*)*">)
+func @memref_call_conv_nested(%arg0: (memref<?xf32>) -> ())
+
//CHECK-LABEL: llvm.func @pass_through(%arg0: !llvm<"void ()*">) -> !llvm<"void ()*"> {
func @pass_through(%arg0: () -> ()) -> (() -> ()) {
// CHECK-NEXT: llvm.br ^bb1(%arg0 : !llvm<"void ()*">)
OpenPOWER on IntegriCloud