[Mlir-commits] [mlir] Expand the MemRefToEmitC pass - Adding scalars (PR #148055)

Paul Kirth llvmlistbot at llvm.org
Fri Jul 11 11:33:53 PDT 2025


================
@@ -95,7 +97,13 @@ struct ConvertGlobal final : public OpConversionPattern<memref::GlobalOp> {
           op.getLoc(), "global variable with alignment requirement is "
                        "currently not supported");
     }
-    auto resultTy = getTypeConverter()->convertType(op.getType());
+
+    Type resultTy;
+    if (type.getRank() == 0)
+      resultTy = getTypeConverter()->convertType(type.getElementType());
+    else
+      resultTy = getTypeConverter()->convertType(type);
----------------
ilovepi wrote:

Maybe introduce a helper, since I see a similar pattern in a few spots?

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


More information about the Mlir-commits mailing list