[mlir][linalg] Fold duplicate and unused inputs in linalg.generic
authorMatthias Springer <springerm@google.com>
Fri, 9 Dec 2022 14:17:30 +0000 (15:17 +0100)
committerMatthias Springer <springerm@google.com>
Fri, 9 Dec 2022 14:18:26 +0000 (15:18 +0100)
commite7328a9eb22307d80f86f668a75c2b082ee8636e
treeabb4eb6c02eb979370c33c4af44b36ff62ebe8ef
parente96ddad85ca03ddd76a7b0571771709fb1fd1b53
[mlir][linalg] Fold duplicate and unused inputs in linalg.generic

If an input bbArg is not used, its corresponding input operand is removed. If there are duplicate input operands or input operands that are also used as output operands, the duplicate input operands are removed. Output operands are never modified.

Differential Revision: https://reviews.llvm.org/D139709
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
mlir/lib/Dialect/Linalg/Transforms/EraseUnusedOperandsAndResults.cpp
mlir/test/Dialect/Linalg/erase-unused-operands-and-results.mlir
mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp