[Mlir-commits] [mlir] Keep attributes on bufferization of	execute_region. (PR #165381)
    llvmlistbot at llvm.org 
    llvmlistbot at llvm.org
       
    Tue Oct 28 05:45:32 PDT 2025
    
    
  
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-scf
Author: None (ddubov100)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/165381.diff
2 Files Affected:
- (modified) mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp (+1) 
- (modified) mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir (+3-2) 
``````````diff
diff --git a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
index 47c99642b9c37..c4b23b5d8c0c6 100644
--- a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -190,6 +190,7 @@ struct ExecuteRegionOpInterface
     // Create new op and move over region.
     auto newOp = scf::ExecuteRegionOp::create(
         rewriter, op->getLoc(), newResultTypes, executeRegionOp.getNoInline());
+    newOp->setAttrs(executeRegionOp->getAttrs());
     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 8db1ebb87a1e5..fa4f6dfa9de40 100644
--- a/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir
+++ b/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir
@@ -369,10 +369,11 @@ func.func private @execute_region_test(%t1 : tensor<?xf32>)
   // CHECK-NOT: alloc
   // CHECK-NOT: copy
   // CHECK: memref.store %{{.*}}, %[[m1]][%{{.*}}]
-  %0, %1, %2 = scf.execute_region -> (f32, tensor<?xf32>, f32) {
+  %0, %1, %2 = scf.execute_region -> (f32, tensor<?xf32>, f32) no_inline {
     %t2 = tensor.insert %f2 into %t1[%idx] : tensor<?xf32>
     scf.yield %f1, %t2, %f2 : f32, tensor<?xf32>, f32
-  }
+  // CHECK: {test.custom_attr = "custom_value"}
+  } {test.custom_attr = "custom_value"}
 
   // CHECK: return %{{.*}}, %{{.*}} : f32, f32
   return %0, %1, %2 : f32, tensor<?xf32>, f32
``````````
</details>
https://github.com/llvm/llvm-project/pull/165381
    
    
More information about the Mlir-commits
mailing list