[Mlir-commits] [mlir] [mlir][EmitC]Expand the MemRefToEmitC pass - Lowering `AllocOp` (PR #148257)

Gil Rapaport llvmlistbot at llvm.org
Fri Jul 25 08:37:03 PDT 2025


================
@@ -77,6 +81,75 @@ struct ConvertAlloca final : public OpConversionPattern<memref::AllocaOp> {
   }
 };
 
+struct ConvertAlloc final : public OpConversionPattern<memref::AllocOp> {
+  using OpConversionPattern::OpConversionPattern;
+  LogicalResult
+  matchAndRewrite(memref::AllocOp allocOp, OpAdaptor operands,
+                  ConversionPatternRewriter &rewriter) const override {
+    mlir::Location loc = allocOp.getLoc();
+    MemRefType memrefType = allocOp.getType();
+    if (!memrefType.hasStaticShape()) {
----------------
aniragil wrote:

See `populateMemRefToEmitCTypeConversion()` for other relevant checks (best to refactor these out to a function and call it from both places).

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


More information about the Mlir-commits mailing list