[Mlir-commits] [mlir] [mlir][emitc] Support dense as init value of constantOp (PR #144826)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Jun 20 02:44:11 PDT 2025


================
@@ -1328,6 +1328,16 @@ LogicalResult CppEmitter::emitAttribute(Location loc, Attribute attr) {
     }
   };
 
+  auto getDenseElementType = [&](const Type &type) {
+    if (auto arrayType = dyn_cast<ArrayType>(type)) {
+      return arrayType.getElementType();
+    }
+    if (auto tensorType = dyn_cast<TensorType>(type)) {
+      return tensorType.getElementType();
+    }
+    return Type();
+  };
+
----------------
tpopp wrote:

Should this be `ShapedType` instead? Also, it might be worth considering adding an `assert`

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


More information about the Mlir-commits mailing list