[all-commits] [llvm/llvm-project] 239784: [mlir][Transforms] Keep track of nested ignored/re...

Matthias Springer via All-commits all-commits at lists.llvm.org
Wed Feb 28 01:06:54 PST 2024


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

  Changed paths:
    M mlir/lib/Transforms/Utils/DialectConversion.cpp
    M mlir/test/lib/Dialect/Test/TestPatterns.cpp

  Log Message:
  -----------
  [mlir][Transforms] Keep track of nested ignored/replaced ops

The dialect conversion maintains sets of "ignored" and "replaced" ops. This change simplifies the two sets, such that all nested ops are included. (This was previously not the case and sometimes only the parent op was included.)

This change allows for more aggressive assertions to prevent incorrect rewriter API usage. E.g., accessing ops/blocks/regions within an erased op.

A concrete example: I have seen conversion patterns in downstream projects where an op is replaced with a new op, and the region of the old op is afterwards inlined into the newly created op. This is invalid rewriter API usage: ops that were replaced/erased should not be accessed. Nested ops will be considered "ignored", even if they are moved to a different region after the region's parent op was erased (which is illegal API usage). Instead, create a new op, inline the regions, then replace the old op with the new op.

BEGIN_PUBLIC
No commit message needed for presubmit.
END_PUBLIC



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