[Mlir-commits] [mlir] [mlir][memref] Fix hoist-static-allocs option of buffer-results-to-out-params when function parameters are returned (PR #102093)
donald chen
llvmlistbot at llvm.org
Tue Aug 27 02:10:31 PDT 2024
================
@@ -34,4 +34,15 @@ func.func @basic_dynamic(%d: index) -> (memref<?xf32>) {
%b = memref.alloc(%d) : memref<?xf32>
"test.source"(%b) : (memref<?xf32>) -> ()
return %b : memref<?xf32>
-}
\ No newline at end of file
+}
+
+// CHECK-LABEL: func @return_arg(
+// CHECK-SAME: %[[ARG0:.*]]: memref<128x256xf32>, %[[ARG1:.*]]: memref<128x256xf32>, %[[ARG2:.*]]: memref<128x256xf32>) {
+// CHECK: "test.source"(%[[ARG0]], %[[ARG1]])
+// CHECK-NOT: memref.copy
+// CHECK: return
+// CHECK: }
+func.func @return_arg(%arg0: memref<128x256xf32>, %arg1: memref<128x256xf32>) -> memref<128x256xf32> {
+ "test.source"(%arg0, %arg1) : (memref<128x256xf32>, memref<128x256xf32>) -> ()
+ return %arg0 : memref<128x256xf32>
+}
----------------
cxy-1993 wrote:
I don't think this issue should be solved by buffering, but rather by some kind of inter-process optimization to simplify this single copy.
https://github.com/llvm/llvm-project/pull/102093
More information about the Mlir-commits
mailing list