[all-commits] [llvm/llvm-project] ea2d93: [mlir][Transforms][NFC] Improve listener layering ...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Wed Feb 14 07:51:40 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ea2d9383a23ca17b9240ad64c2adc5f2b5a73dc0
https://github.com/llvm/llvm-project/commit/ea2d9383a23ca17b9240ad64c2adc5f2b5a73dc0
Author: Matthias Springer <me at m-sp.org>
Date: 2024-02-14 (Wed, 14 Feb 2024)
Changed paths:
M flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
M mlir/include/mlir/Transforms/DialectConversion.h
M mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
M mlir/lib/Transforms/Utils/DialectConversion.cpp
Log Message:
-----------
[mlir][Transforms][NFC] Improve listener layering in dialect conversion (#81236)
Context: Conversion patterns provide a `ConversionPatternRewriter` to
modify the IR. `ConversionPatternRewriter` provides the public API. Most
function calls are forwarded/handled by `ConversionPatternRewriterImpl`.
The dialect conversion uses the listener infrastructure to get notified
about op/block insertions.
In the current design, `ConversionPatternRewriter` inherits from both
`PatternRewriter` and `Listener`. The conversion rewriter registers
itself as a listener. This is problematic because listener functions
such as `notifyOperationInserted` are now part of the public API and can
be called from conversion patterns; that would bring the dialect
conversion into an inconsistent state.
With this commit, `ConversionPatternRewriter` no longer inherits from
`Listener`. Instead `ConversionPatternRewriterImpl` inherits from
`Listener`. This removes the problematic public API and also simplifies
the code a bit: block/op insertion notifications were previously
forwarded to the `ConversionPatternRewriterImpl`. This is no longer
needed.
More information about the All-commits
mailing list