llvm-project
15c5ef47 - [mlir][Transforms] Support `replaceAllUsesWith` in dialect conversion

Commit
1 year ago
[mlir][Transforms] Support `replaceAllUsesWith` in dialect conversion This commit adds support for `RewriterBase::replaceAllUsesWith` to the dialect conversion. Uses are not immediately replaced, but in a delayed fashion during the "commit" phase. No type conversions are performed; this is consistent with `ConversionPatternRewriter::replaceUsesOfBlockArgument`. - `RewriterBase::replaceAllUsesWith` is now virtual, so that it can be overridden in the dialect conversion. Note: `RewriterBase::replaceOp` can now be turned into a non-virtual function in a follow-up commit. - `ConversionPatternRewriter::replaceUsesOfBlockArgument` is generalized to `ConversionPatternRewriter::replaceAllUsesWith`, following the same implementation strategy. - A new kind of "IR rewrite" is added: `ValueRewrite` with `ReplaceAllUsesRewrite` (replacing `ReplaceBlockArgRewrite`) as the only value rewrite for now. - `replacedOps` is renamed to `erasedOps` to better capture its meaning. BEGIN_PUBLIC No public commit message needed for presubmit. END_PUBLIC
Committer
Parents
Loading