[Mlir-commits] [mlir] [mlir][IR] Generalize`DenseElementsAttr` to custom element types (PR #179122)

Jeremy Kun llvmlistbot at llvm.org
Thu Feb 5 13:53:22 PST 2026


================
@@ -19,6 +22,53 @@ using namespace mlir::detail;
 
 #include "mlir/IR/BuiltinTypeInterfaces.cpp.inc"
 
+//===----------------------------------------------------------------------===//
+// DenseElementTypeInterface default implementations
+//===----------------------------------------------------------------------===//
+
+size_t mlir::detail::getDefaultDenseElementBitSize(Type type) {
+  // TODO: This implementation should be defined on FloatType. However, due to
+  // TableGen limitations, a type interface cannot provide an implementation for
+  // an interface method from a base type interface.
+  auto floatType = dyn_cast<FloatType>(type);
----------------
j2kun wrote:

nit: why not cast instead of `dyn_cast` + `llvm_unreachable`?

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


More information about the Mlir-commits mailing list