diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp --- a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp +++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp @@ -356,7 +356,7 @@ Operation *allocOp = alloc.getDefiningOp(); Operation *alloca = builder.create( alloc.getLoc(), alloc.getType().cast(), - 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 --- a/mlir/test/Transforms/promote-buffers-to-stack.mlir +++ b/mlir/test/Transforms/promote-buffers-to-stack.mlir @@ -603,11 +603,11 @@ // CHECK-LABEL: func @bigIndexElementType module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry>} { func.func @bigIndexElementType() { - %0 = memref.alloc() : memref<4xindex> + %0 = memref.alloc() {alignment = 64 : i64} : memref<4xindex> return } } -// DEFINDEX-NEXT: memref.alloca() -// LOWLIMIT-NEXT: memref.alloc() -// RANK-NEXT: memref.alloca() +// DEFINDEX-NEXT: memref.alloca() {alignment = 64 : i64} +// LOWLIMIT-NEXT: memref.alloc() {alignment = 64 : i64} +// RANK-NEXT: memref.alloca() {alignment = 64 : i64} // CHECK-NEXT: return