[all-commits] [llvm/llvm-project] 695a5a: [mlir][IR] Trigger `notifyOperationRemoved` callba...

Matthias Springer via All-commits all-commits at lists.llvm.org
Tue Sep 19 23:46:00 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 695a5a6a66396b83263bbb3f1946fbaf41e422c3
      https://github.com/llvm/llvm-project/commit/695a5a6a66396b83263bbb3f1946fbaf41e422c3
  Author: Matthias Springer <me at m-sp.org>
  Date:   2023-09-20 (Wed, 20 Sep 2023)

  Changed paths:
    M mlir/include/mlir/IR/RegionKindInterface.h
    M mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
    M mlir/lib/IR/PatternMatch.cpp
    M mlir/lib/IR/RegionKindInterface.cpp
    M mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
    M mlir/test/Transforms/test-strict-pattern-driver.mlir
    M mlir/test/lib/Dialect/Test/TestPatterns.cpp

  Log Message:
  -----------
  [mlir][IR] Trigger `notifyOperationRemoved` callback for nested ops (#66771)

When cloning an op, the `notifyOperationInserted` callback is triggered
for all nested ops. Similarly, the `notifyOperationRemoved` callback
should be triggered for all nested ops when removing an op.

Listeners may inspect the IR during a `notifyOperationRemoved` callback.
Therefore, when multiple ops are removed in a single
`RewriterBase::eraseOp` call, the notifications must be triggered in an
order in which the ops could have been removed one-by-one:

* Op removals must be interleaved with `notifyOperationRemoved`
callbacks. A callback is triggered right before the respective op is
removed.
* Ops are removed post-order and in reverse order. Other traversal
orders could delete an op that still has uses. (This is not avoidable in
graph regions and with cyclic block graphs.)

Differential Revision: Imported from https://reviews.llvm.org/D144193.




More information about the All-commits mailing list