Fix deletion of operations through the rewriter in a pattern matching a consumer...
authorMehdi Amini <joker.eph@gmail.com>
Tue, 30 Mar 2021 21:11:02 +0000 (21:11 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Tue, 30 Mar 2021 22:02:14 +0000 (22:02 +0000)
commita360a9786f5f82f4beff6fdcec12b40ee392db7a
tree6631ee789cdecf185f917691492c23eeb41f7eff
parent427d3597219ec16c1bc92a0f4c9e39015e80c923
Fix deletion of operations through the rewriter in a pattern matching a consumer operation

This allows for the conversion to match `A(B()) -> C()` with a pattern matching
`A` and marking `B` for deletion.

Also add better assertions when an operation is erased while still having uses.

Differential Revision: https://reviews.llvm.org/D99442
mlir/lib/IR/Operation.cpp
mlir/lib/Transforms/Utils/DialectConversion.cpp
mlir/test/Transforms/test-legalizer.mlir
mlir/test/lib/Dialect/Test/TestOps.td
mlir/test/lib/Dialect/Test/TestPatterns.cpp