[Mlir-commits] [mlir] [mlir][IR][NFC] Simplify "splat" handling in `DenseIntOrFPElementsAttr` (PR #180965)

Jakub Kuderski llvmlistbot at llvm.org
Wed Feb 11 08:23:52 PST 2026


================
@@ -1121,7 +1112,13 @@ bool DenseElementsAttr::isValidComplex(int64_t dataEltSize, bool isInt,
 /// Returns true if this attribute corresponds to a splat, i.e. if all element
 /// values are the same.
 bool DenseElementsAttr::isSplat() const {
-  return static_cast<DenseElementsAttributeStorage *>(impl)->isSplat;
+  // Splat iff the data array has exactly one element.
+  if (llvm::isa<DenseStringElementsAttr>(*this))
----------------
kuhar wrote:

```suggestion
  if (isa<DenseStringElementsAttr>(*this))
```

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


More information about the Mlir-commits mailing list