[llvm-branch-commits] [mlir] [mlir][Transforms] Add listener support to dialect conversion (PR #83425)

Matthias Springer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Mar 4 15:35:43 PST 2024


matthias-springer wrote:

> > _[Reviewable](https://reviewable.io/reviews/llvm/llvm-project/83425)_ status: 0 of 4 files reviewed, 1 unresolved discussion (waiting on @ftynse, @joker-eph, and @matthias-springer)
> 
> _[`mlir/lib/Transforms/Utils/DialectConversion.cpp` line 363 at r1](https://reviewable.io/reviews/llvm/llvm-project/83425#-Ns3aO9h2L3R0Ul-IX4T:-Ns3aO9h2L3R0Ul-IX4U:blphauh) ([raw file](https://github.com/llvm/llvm-project/blob/22e8d5ea80b74d687c3e792c512f50b9de81f489/mlir/lib/Transforms/Utils/DialectConversion.cpp#L363)):_
> 
> > ```c++
> >       // notification and iterators into past IR state cannot be represented.
> >       listener->notifyBlockInserted(block, /*previous=*/region,
> >                                     /*previousIt=*/{});
> > ```
> 
> And this is expected in the consumer that it may get not previousIt?

Yes, that's expected because the IR was already modified (possibly a long time ago before the notification is sent) and `Region::iterator` / `Block::iterator` into past IR state cannot be represented. (We could pass a `Block *before` / `Operation *before` in to `notifyBlockInserted` / `notifyOperationInserted` in the future instead, if needed.) I updated the documentation of `ConversionConfig::listener`.


https://github.com/llvm/llvm-project/pull/83425


More information about the llvm-branch-commits mailing list