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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Jun 23 04:00:50 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Matthias Springer (matthias-springer)

<details>
<summary>Changes</summary>

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.
```




---
Full diff: https://github.com/llvm/llvm-project/pull/145308.diff


1 Files Affected:

- (modified) mlir/lib/Transforms/Utils/DialectConversion.cpp (+1-1) 


``````````diff
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();

``````````

</details>


https://github.com/llvm/llvm-project/pull/145308


More information about the Mlir-commits mailing list