[Mlir-commits] [mlir] ace6072 - [mlir] PromoteBuffersToStackPass - Copy attributes of original AllocOp

Maya Amrami llvmlistbot at llvm.org
Thu Feb 16 07:06:52 PST 2023


Author: Maya Amrami
Date: 2023-02-16T17:06:45+02:00
New Revision: ace6072bca65f946478edeeee018ca1d6a947a3e

URL: https://github.com/llvm/llvm-project/commit/ace6072bca65f946478edeeee018ca1d6a947a3e
DIFF: https://github.com/llvm/llvm-project/commit/ace6072bca65f946478edeeee018ca1d6a947a3e.diff

LOG: [mlir] PromoteBuffersToStackPass - Copy attributes of original AllocOp

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D143185

Added: 
    

Modified: 
    mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
    mlir/test/Transforms/promote-buffers-to-stack.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
index 5710d3af8da95..83b2ef6a6dac7 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
@@ -356,7 +356,7 @@ class BufferPlacementPromotion : BufferPlacementTransformationBase {
       Operation *allocOp = alloc.getDefiningOp();
       Operation *alloca = builder.create<memref::AllocaOp>(
           alloc.getLoc(), alloc.getType().cast<MemRefType>(),
-          allocOp->getOperands());
+          allocOp->getOperands(), allocOp->getAttrs());
 
       // Replace the original alloc by a newly created alloca.
       allocOp->replaceAllUsesWith(alloca);

diff  --git a/mlir/test/Transforms/promote-buffers-to-stack.mlir b/mlir/test/Transforms/promote-buffers-to-stack.mlir
index 243fbb198e60d..f7f2d2ec114ca 100644
--- a/mlir/test/Transforms/promote-buffers-to-stack.mlir
+++ b/mlir/test/Transforms/promote-buffers-to-stack.mlir
@@ -603,11 +603,11 @@ func.func @indexElementType() {
 // CHECK-LABEL: func @bigIndexElementType
 module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<index, 256>>} {
   func.func @bigIndexElementType() {
-    %0 = memref.alloc() : memref<4xindex>
+    %0 = memref.alloc() {alignment = 64 : i64, custom_attr} : memref<4xindex>
     return
   }
 }
-// DEFINDEX-NEXT: memref.alloca()
-// LOWLIMIT-NEXT: memref.alloc()
-// RANK-NEXT: memref.alloca()
+// DEFINDEX-NEXT: memref.alloca() {alignment = 64 : i64, custom_attr}
+// LOWLIMIT-NEXT: memref.alloc() {alignment = 64 : i64, custom_attr}
+// RANK-NEXT: memref.alloca() {alignment = 64 : i64, custom_attr}
 // CHECK-NEXT: return


        


More information about the Mlir-commits mailing list