[Mlir-commits] [mlir] [mlir][LICM] Restrict LICM to pure tensor semantics (PR #129673)

donald chen llvmlistbot at llvm.org
Mon Mar 17 18:49:20 PDT 2025


================
@@ -595,3 +595,19 @@ func.func @hoist_vector_transfer_write_pairs_disjoint_tensor(
   }
   return %1 : tensor<?x?xf32>
 }
+
+// -----
+
+// Ensure that cases with buffer semantics exit gracefully.
+
+// CHECK-LABEL: @hoist_buffer
+func.func @hoist_buffer(%arg0: memref<7x7xf16>) {
+  %c0 = arith.constant 0 : index
+  %c1 = arith.constant 1 : index
+  %alloc = memref.alloc() : memref<7x7xf16>
+  %0 = scf.for %arg1 = %c0 to %c1 step %c1 iter_args(%arg2 = %alloc) -> (memref<7x7xf16>) {
+    linalg.copy ins(%arg0 : memref<7x7xf16>) outs(%arg2 : memref<7x7xf16>)
+    scf.yield %alloc : memref<7x7xf16>
+  }
+  return
+}
----------------
cxy-1993 wrote:

Why didn't the test checks that linalg.copy wasn't moved outside the loop?

https://github.com/llvm/llvm-project/pull/129673


More information about the Mlir-commits mailing list