[Mlir-commits] [mlir] [mlir][acc] Extend PointerLikeType to provide alloc, dealloc, copy (PR #162328)

Razvan Lupusoru llvmlistbot at llvm.org
Wed Oct 8 10:01:17 PDT 2025


================
@@ -70,6 +72,116 @@ struct MemRefPointerLikeModel
     assert(memrefTy.getRank() > 0 && "rank expected to be positive");
     return mlir::acc::VariableTypeCategory::array;
   }
+
+  mlir::Value genAllocate(Type pointer, OpBuilder &builder, Location loc,
+                          StringRef varName, Type varType,
+                          Value originalVar) const {
+    auto memrefTy = cast<MemRefType>(pointer);
+
+    // Check if this is a static memref (all dimensions are known) - if yes
+    // then we can generate an alloca operation.
+    if (memrefTy.hasStaticShape()) {
+      return memref::AllocaOp::create(builder, loc, memrefTy).getResult();
+    }
----------------
razvanlupusoru wrote:

Fixed.

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


More information about the Mlir-commits mailing list