[Mlir-commits] [mlir] [mlir][Linalg] NFC: Expose a method to deduplicate operands/remove dead results of `linalg.generic` op. (PR #125141)

Kunwar Grover llvmlistbot at llvm.org
Thu Jan 30 17:32:30 PST 2025


================
@@ -1785,8 +1785,16 @@ void populateDataLayoutPropagationPatterns(
     RewritePatternSet &patterns,
     const ControlPropagationFn &controlPackUnPackPropagation);
 
+/// Method to deduplicate operands and remove dead results of `linalg.generic`
+/// operations. This is effectively DCE for a linalg.generic op. If there is
+/// deduplication of operands orremoval of results, replaces the `genericOp`
+/// with a new op and returns it. Returns the same operation if there is no
+/// deduplication/removal.
+FailureOr<linalg::GenericOp> deduplicateOperandsAndRemoveDeadResults(
+    RewriterBase &rewriter, linalg::GenericOp genericOp, bool removeOutputs);
----------------
Groverkss wrote:

Can you move this transformation closer to other transformations (above all the populate patterns)? It's more consistent with how this file is structured.

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


More information about the Mlir-commits mailing list