[Mlir-commits] [mlir] [mlir][scf] ExecuteRegionOp bufferization to consider no_inline attr (PR #160697)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Sep 25 05:57:43 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-scf
@llvm/pr-subscribers-mlir-bufferization
Author: Dor Arad (undor)
<details>
<summary>Changes</summary>
Fix a bug where ExecuteRegionOp bufferization dropped the "no_inline" attribute.
---
Full diff: https://github.com/llvm/llvm-project/pull/160697.diff
2 Files Affected:
- (modified) mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp (+2-2)
- (modified) mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir (+14)
``````````diff
diff --git a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
index fb179e64d8e7b..47c99642b9c37 100644
--- a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -188,8 +188,8 @@ struct ExecuteRegionOpInterface
TypeRange newResultTypes(yieldOp.getResults());
// Create new op and move over region.
- auto newOp =
- scf::ExecuteRegionOp::create(rewriter, op->getLoc(), newResultTypes);
+ auto newOp = scf::ExecuteRegionOp::create(
+ rewriter, op->getLoc(), newResultTypes, executeRegionOp.getNoInline());
newOp.getRegion().takeBody(executeRegionOp.getRegion());
// Bufferize every block.
diff --git a/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir b/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir
index eb0093106dc11..6054a61912532 100644
--- a/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir
+++ b/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir
@@ -380,6 +380,20 @@ func.func @execute_region_test(%t1 : tensor<?xf32>)
// -----
+// CHECK-LABEL: func @no_inline_execute_region_not_canonicalized
+func.func @no_inline_execute_region_not_canonicalized() {
+ %c = arith.constant 42 : i32
+ // CHECK: scf.execute_region
+ // CHECK-SAME: no_inline
+ %v = scf.execute_region -> i32 no_inline {
+ scf.yield %c : i32
+ }
+ // CHECK: return
+ return
+}
+
+// -----
+
// CHECK: func private @some_external_func(memref<?xf32, strided<[?], offset: ?>>)
func.func private @some_external_func(tensor<?xf32>)
``````````
</details>
https://github.com/llvm/llvm-project/pull/160697
More information about the Mlir-commits
mailing list