[mlir] Update `simplifyRegions` to use RewriterBase for erasure notifications
authorRiver Riddle <riddleriver@gmail.com>
Fri, 19 Mar 2021 23:19:23 +0000 (16:19 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Fri, 19 Mar 2021 23:33:54 +0000 (16:33 -0700)
commitd75a611afbc7c5f8c343e0398dd2b506684e506b
treec3382eb36b4e75b0db398511ab2267809897c8e4
parenteef8b74ef5efd5265ad35c8d6ebdbfbe43e81bfd
[mlir] Update `simplifyRegions` to use RewriterBase for erasure notifications

This allows for notifying callers when operations/blocks get erased, which is especially useful for the greedy pattern driver. The current greedy pattern driver "throws away" all information on constants in the operation folder because it doesn't know if they get erased or not. By passing in RewriterBase, we can directly track this and prevent the need for the pattern driver to rediscover all of the existing constants. In some situations this cuts the compile time of the canonicalizer in half.

Differential Revision: https://reviews.llvm.org/D98755
mlir/include/mlir/Transforms/RegionUtils.h
mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
mlir/lib/Transforms/Utils/RegionUtils.cpp
mlir/test/Dialect/SCF/canonicalize.mlir