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

Matthias Springer via All-commits all-commits at lists.llvm.org
Tue Feb 27 05:40:52 PST 2024


  Branch: refs/heads/users/matthias-springer/access_erased_assertions
  Home:   https://github.com/llvm/llvm-project
  Commit: 3216b262a9d95ab33ecdd59215b7d2c3100273fc
      https://github.com/llvm/llvm-project/commit/3216b262a9d95ab33ecdd59215b7d2c3100273fc
  Author: Matthias Springer <springerm at google.com>
  Date:   2024-02-27 (Tue, 27 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