[Mlir-commits] [mlir] [mlir][Transforms] Dialect Conversion: Simplify block-inline handling (PR #145308)

Matthias Springer llvmlistbot at llvm.org
Mon Jun 23 04:00:17 PDT 2025


https://github.com/matthias-springer created https://github.com/llvm/llvm-project/pull/145308

When a block is getting inlined, the destination block does not have to be legalized. That's because the signature of the destination block does not change by inlining.

This commit makes the implementation consistent with this comment:
```
  // If the pattern moved or created any blocks, make sure the types of block
  // arguments get legalized.
```




>From cb2a49497c7f90c134ac1b1b1ea9db0a0061ce6b Mon Sep 17 00:00:00 2001
From: Matthias Springer <me at m-sp.org>
Date: Mon, 23 Jun 2025 10:57:19 +0000
Subject: [PATCH] [mlir][Transforms] Dialect Conversion: Simplify block-inline
 handling

---
 mlir/lib/Transforms/Utils/DialectConversion.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 9cb6f2ba1eaae..7cfe7250d02c3 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -2301,7 +2301,7 @@ LogicalResult OperationLegalizer::legalizePatternBlockRewrites(
       continue;
     Block *block = rewrite->getBlock();
     if (isa<BlockTypeConversionRewrite, EraseBlockRewrite,
-            ReplaceBlockArgRewrite>(rewrite))
+            ReplaceBlockArgRewrite, InlineBlockRewrite>(rewrite))
       continue;
     // Only check blocks outside of the current operation.
     Operation *parentOp = block->getParentOp();



More information about the Mlir-commits mailing list