[all-commits] [llvm/llvm-project] 552f1a: [mlir][Transforms] Dialect conversion: Simplify ha...

Matthias Springer via All-commits all-commits at lists.llvm.org
Sun Jun 30 05:32:53 PDT 2024


  Branch: refs/heads/users/matthias-springer/block_arg_rewrite_2
  Home:   https://github.com/llvm/llvm-project
  Commit: 552f1a8152f17ca82a576aefa056a7eb9667da37
      https://github.com/llvm/llvm-project/commit/552f1a8152f17ca82a576aefa056a7eb9667da37
  Author: Matthias Springer <me at m-sp.org>
  Date:   2024-06-30 (Sun, 30 Jun 2024)

  Changed paths:
    M mlir/docs/DialectConversion.md
    M mlir/include/mlir/Transforms/DialectConversion.h
    M mlir/lib/Transforms/Utils/DialectConversion.cpp
    M mlir/test/Transforms/test-legalize-type-conversion.mlir

  Log Message:
  -----------
  [mlir][Transforms] Dialect conversion: Simplify handling of dropped arguments (#96207)

This commit simplifies the handling of dropped arguments and updates
some dialect conversion documentation that is outdated.

When converting a block signature, a `BlockTypeConversionRewrite` object
and potentially multiple `ReplaceBlockArgRewrite` are created. During
the "commit" phase, uses of the old block arguments are replaced with
the new block arguments, but the old implementation was written in an
inconsistent way: some block arguments were replaced in
`BlockTypeConversionRewrite::commit` and some were replaced in
`ReplaceBlockArgRewrite::commit`. The new
`BlockTypeConversionRewrite::commit` implementation is much simpler and
no longer modifies any IR; that is done only in `ReplaceBlockArgRewrite`
now. The `ConvertedArgInfo` data structure is no longer needed.

To that end, materializations of dropped arguments are now built in
`applySignatureConversion` instead of `materializeLiveConversions`; the
latter function no longer has to deal with dropped arguments.

Other minor improvements:
- Improve variable name: `origOutputType` -> `origArgType`. Add an
assertion to check that this field is only used for argument
materializations.
- Add more comments to `applySignatureConversion`.

Note: Error messages around failed materializations for dropped basic
block arguments changed slightly. That is because those materializations
are now built in `legalizeUnresolvedMaterialization` instead of
`legalizeConvertedArgumentTypes`.

This commit is in preparation of decoupling argument/source/target
materializations from the dialect conversion.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list