[mlir] add scf.if op canonicalization pattern that removes unused results
authorTobias Gysi <tobias.gysi@gmail.com>
Sun, 11 Oct 2020 08:40:28 +0000 (10:40 +0200)
committerTobias Gysi <tobias.gysi@gmail.com>
Sun, 11 Oct 2020 08:40:28 +0000 (10:40 +0200)
commit93377888ae89560ba6d3976e2762d3d4724c4dfd
treecab52e40087478532e1dfd30df36db7144cd85a2
parent667dfe39caa0023b1d00b3e126c7df57702aaf14
[mlir] add scf.if op canonicalization pattern that removes unused results

The patch adds a canonicalization pattern that removes the unused results of scf.if operation. As a result, cse may remove unused computations in the then and else regions of the scf.if operation.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D89029
mlir/include/mlir/Dialect/SCF/SCFOps.td
mlir/lib/Dialect/SCF/SCF.cpp
mlir/test/Dialect/SCF/canonicalize.mlir