-
Notifications
You must be signed in to change notification settings - Fork 26
Description
The rewriter must keep track of type of replaced values (new value -> replaced value type). This should be query-able from MatchRewrite::rewrite.
During dialect conversions, when rewriting an operation, if the definition of an operand has been replaced (with a possibly new type), converting the operation without the earlier (pre-conversion) type of that operand may not be possible. So that must be kept track of (transitively) and the mapping provided upon request.
MLIR takes the opposite route. The operation provided as the main argument to rewrite will have all its operands unconverted, and the converted types can be queried from the OpAdaptor argument. i.e., old value -> new value type mapping is maintained. (see ConversionPatternRewriterImpl::replaceOp)
Note: A clone, of the top level operation (from where rewrite is performed) is performed and the clone undergoes rewrites, finally committing the clone on success. (reference: mlir::applyAnalysisConversion)