[all-commits] [llvm/llvm-project] c0cba2: [mlir][Transforms] Dialect conversion: Hardening `...

Matthias Springer via All-commits all-commits at lists.llvm.org
Tue Oct 29 05:14:16 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c0cba25cdd06d700bdc15e9ae48c1fcadd0963bd
      https://github.com/llvm/llvm-project/commit/c0cba25cdd06d700bdc15e9ae48c1fcadd0963bd
  Author: Matthias Springer <me at m-sp.org>
  Date:   2024-10-29 (Tue, 29 Oct 2024)

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

  Log Message:
  -----------
  [mlir][Transforms] Dialect conversion: Hardening `replaceOp` (#109540)

This commit adds extra checks/assertions to the
`ConversionPatternRewriterImpl::notifyOpReplaced` to improve its
robustness.

1. Replacing an `unrealized_conversion_cast` op that was created by the
driver is now forbidden and caught early during `replaceOp`. It may work
in some cases, but it is generally dangerous because the conversion
driver keeps track of these ops and performs some extra legalization
steps during the "finalize" phase. (Erasing is them is fine.)
2. `null` replacement values are no longer registered in the
`ConversionValueMapping`. This was an oversight in #106760. There is no
benefit in having `null` values in the `ConversionValueMapping`. (It may
even cause problems.)

This change is in preparation of merging the 1:1 and 1:N dialect
conversion drivers.



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