[Mlir-commits] [mlir] [mlir][spirv] Enable (de)serialization of TensorARM to/from OpConstan… (PR #151485)

Mohammadreza Ameri Mahabadian llvmlistbot at llvm.org
Fri Aug 1 02:53:56 PDT 2025


================
@@ -69,6 +69,22 @@ static Block *getPhiIncomingBlock(Block *block) {
   return block;
 }
 
+static bool isNull(Attribute attr) {
+  if (auto floatAttr = dyn_cast<FloatAttr>(attr)) {
+    return floatAttr.getValue().isZero();
+  }
+  if (auto boolAttr = dyn_cast<BoolAttr>(attr)) {
+    return !boolAttr.getValue();
+  }
+  if (auto intAttr = dyn_cast<IntegerAttr>(attr)) {
+    return intAttr.getValue().isZero();
+  }
+  if (auto denseElemAttr = dyn_cast<DenseElementsAttr>(attr)) {
+    return all_of(denseElemAttr.getValues<Attribute>(), isNull);
----------------
mahabadm wrote:

Good point, thanks. Done.

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


More information about the Mlir-commits mailing list