[Mlir-commits] [mlir] [mlir][memref][transform] Add new alloca_to_global op. (PR #66511)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Wed Sep 20 10:32:39 PDT 2023


================
@@ -16,6 +16,54 @@ def run(f):
     return f
 
 
+ at run
+def testMemRefAllocaToAllocOpCompact():
+    sequence = transform.SequenceOp(
+        transform.FailurePropagationMode.Propagate,
+        [],
+        transform.OperationType.get("memref.alloc"),
+    )
+    with InsertionPoint(sequence.body):
+        module = transform.CastOp(
+            transform.OperationType.get("builtin.module"), sequence.bodyTarget
+        )
+        alloca = transform.CastOp(
+            transform.OperationType.get("memref.alloca"), sequence.bodyTarget
+        )
+        memref.MemRefAllocaToGlobalOp(module, alloca)
+        transform.YieldOp()
----------------
ftynse wrote:

I understand it's a test, but types looks quite wrong here. We are casting `op<"memref.alloc">` to two different other concrete types. This cannot be valid and may break should we introduce some static "type compatibility" checks in the cast. Sequence can have multiple block arguments, let's just use that and give them the expected type immediately.

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


More information about the Mlir-commits mailing list