[all-commits] [llvm/llvm-project] dcd13b: [mlir][Transforms][NFC] Turn block type convertion...

Matthias Springer via All-commits all-commits at lists.llvm.org
Wed Feb 14 08:42:56 PST 2024


  Branch: refs/heads/users/matthias-springer/block_type_conversion
  Home:   https://github.com/llvm/llvm-project
  Commit: dcd13b85b50846d84850388e2bbed74c0aa54e62
      https://github.com/llvm/llvm-project/commit/dcd13b85b50846d84850388e2bbed74c0aa54e62
  Author: Matthias Springer <springerm at google.com>
  Date:   2024-02-14 (Wed, 14 Feb 2024)

  Changed paths:
    M mlir/lib/Transforms/Utils/DialectConversion.cpp

  Log Message:
  -----------
  [mlir][Transforms][NFC] Turn block type convertion into `IRRewrite`

This commit is a refactoring of the dialect conversion. The dialect conversion maintains a list of "IR rewrites" that can be commited (upon success) or rolled back (upon failure).

Until now, the signature conversion of a block was only a "partial" IR rewrite. Rollbacks were triggered via `BlockTypeConversionRewrite::rollback`, but there was no `BlockTypeConversionRewrite::commit` equivalent.

Overview of changes:
* Remove `ArgConverter`, an internal helper class that kept track of all block type conversions. There is now a separate `BlockTypeConversionRewrite` for each block type conversion.
* No more special handling for block type conversions. They are now normal "IR rewrites", just like "block creation" or "block movement". In particular, trigger "commits" of block type conversion via `BlockTypeConversionRewrite::commit`.
* Remove `ArgConverter::notifyOpRemoved`. This function was used to inform the `ArgConverter` that an operation was erased, to prevent a double-free of operations in certain situations. It would be unpractical to add a `notifyOpRemoved` API to `IRRewrite`. Instead, erasing ops/block should go through a new `SingleEraseRewriter` (that is owned by the `ConversionPatternRewriterImpl`) if there is chance of double-free. This rewriter ignores `eraseOp`/`eraseBlock` if the op/block was already freed.




More information about the All-commits mailing list