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

Jacques Pienaar llvmlistbot at llvm.org
Fri Jul 11 13:20:51 PDT 2025


================
@@ -114,6 +122,10 @@ struct ConvertGlobal final : public OpConversionPattern<memref::GlobalOp> {
     bool externSpecifier = !staticSpecifier;
 
     Attribute initialValue = operands.getInitialValueAttr();
+    if (type.getRank() == 0) {
+      auto elementsAttr = llvm::cast<ElementsAttr>(*op.getInitialValue());
+      initialValue = elementsAttr.getSplatValue<Attribute>();
----------------
jpienaar wrote:

What is the initialValue before this vs splat value returned?

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


More information about the Mlir-commits mailing list