[Mlir-commits] [mlir] [mlir] [memref] Elevate `AllocOp`s to `GlobalOp`s pass (PR #211141)

ioana ghiban llvmlistbot at llvm.org
Mon Jul 27 05:27:39 PDT 2026


================
@@ -0,0 +1,140 @@
+// RUN: mlir-opt --elevate-allocs-to-globals --split-input-file %s | FileCheck %s
+
+/// Test that a single static memref.alloc is elevated to a memref.global, references
+/// are replaced with memref.get_global, and the associated memref.dealloc is removed.
+
+func.func @single_alloc() -> memref<10xf32> {
+  %0 = memref.alloc() {alignment = 64 : i64} : memref<10xf32>
----------------
ioghiban wrote:

[nit] Start with a minimal example, with no alignment.
Change as few things from one test case to another - the multiple alloc does not have alignment, so I'd add a separate `single_alloc` test case with alignment above this.

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


More information about the Mlir-commits mailing list