[all-commits] [llvm/llvm-project] 0e37ef: [mlir][transform] Use TrackingListener-aware itera...

Matthias Springer via All-commits all-commits at lists.llvm.org
Mon May 15 01:38:08 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0e37ef08d4d8cf98941937874702825578fcb9c2
      https://github.com/llvm/llvm-project/commit/0e37ef08d4d8cf98941937874702825578fcb9c2
  Author: Matthias Springer <me at m-sp.org>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/Transform/IR/MatchInterfaces.h
    M mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h
    M mlir/lib/Dialect/Affine/TransformOps/AffineTransformOps.cpp
    M mlir/lib/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp
    M mlir/lib/Dialect/Linalg/TransformOps/LinalgMatchOps.cpp
    M mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
    M mlir/lib/Dialect/MemRef/TransformOps/MemRefTransformOps.cpp
    M mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
    M mlir/lib/Dialect/Transform/IR/TransformOps.cpp
    M mlir/test/Dialect/Transform/test-interpreter.mlir
    M mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp
    M mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.td

  Log Message:
  -----------
  [mlir][transform] Use TrackingListener-aware iterator for getPayloadOps

Instead of returning an `ArrayRef<Operation *>`, return at iterator that skips ops that were erased/replaced while iterating over the payload ops.

This fixes an issue in conjuction with TrackingListener, where a tracked op was erased during the iteration. Elements may not be removed from an array while iterating over it; this invalidates the iterator.

When ops are erased/removed via `replacePayloadOp`, they are not immediately removed from the mappings data structure. Instead, they are set to `nullptr`. `nullptr`s are not enumerated by `getPayloadOps`. At the end of each transformation, `nullptr`s are removed from the mapping data structure.

Differential Revision: https://reviews.llvm.org/D149847




More information about the All-commits mailing list