[Mlir-commits] [mlir] Fold `linalg.fill` -> `linalg.copy` (PR #72920)

Andrzej WarzyƄski llvmlistbot at llvm.org
Tue Nov 21 00:00:21 PST 2023


================
@@ -972,3 +972,29 @@ func.func @canonicalize_dim_of_dest_style_op(%arg0 : tensor<?x?xf32>) -> tensor<
   %3 = linalg.copy ins(%1 : tensor<?x?xf32>) outs(%2 : tensor<?x?xf32>) -> tensor<?x?xf32>
   return %3: tensor<?x?xf32>
 }
+// -----
+
+// CHECK-LABEL: func @canonicalize_fill_to_copy_input(
+//  CHECK-SAME:     %[[ARG0:[a-zA-Z0-9]+]]: tensor<?x?xf32>
+//  CHECK-SAME:     %[[ARG1:[a-zA-Z0-9]+]]: tensor<?x?xf32>)
+//       CHECK:   %[[ZERO:.+]] = arith.constant 0.0
----------------
banach-space wrote:

Wouldn't DCE get rid of `linalg.copy` here?

```suggestion
//       CHECK:   %[[ZERO:.+]] = arith.constant 0.0
//       CHECK-NOT: linalg.copy
```
Similar comment below.

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


More information about the Mlir-commits mailing list