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

Jaden Angella llvmlistbot at llvm.org
Mon Jul 14 08:54:30 PDT 2025


================
@@ -132,7 +144,17 @@ struct ConvertGetGlobal final
   matchAndRewrite(memref::GetGlobalOp op, OpAdaptor operands,
                   ConversionPatternRewriter &rewriter) const override {
 
-    auto resultTy = getTypeConverter()->convertType(op.getType());
+    MemRefType type = op.getType();
+    Type resultTy;
+    if (type.getRank() == 0)
+      resultTy = emitc::LValueType::get(
----------------
Jaddyen wrote:

`memref.getGlobal` gets converted to `emitc.getglobal` but `emitc.getglobal` only returns LValue and Array. So in the case that we have a constant, we create an LValue, else we return an array. 

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


More information about the Mlir-commits mailing list