[Mlir-commits] [mlir] [mlir][spirv] Add conversion pass to rewrite splat constant composite… (PR #148910)

Jakub Kuderski llvmlistbot at llvm.org
Fri Jul 18 08:44:03 PDT 2025


================
@@ -25,27 +25,24 @@ namespace {
 static std::pair<Attribute, uint32_t>
 getSplatAttrAndNumElements(Attribute valueAttr) {
   Attribute attr;
-  uint32_t splatCount = 0;
+  uint32_t numElements = 0;
   if (auto splatAttr = dyn_cast<SplatElementsAttr>(valueAttr)) {
     return {splatAttr.getSplatValue<Attribute>(), splatAttr.size()};
   }
   if (auto arrayAttr = dyn_cast<ArrayAttr>(valueAttr)) {
     if (llvm::all_equal(arrayAttr)) {
       attr = arrayAttr[0];
-      splatCount = arrayAttr.size();
-    }
+      numElements = arrayAttr.size();
----------------
kuhar wrote:

I would make these local variables now and return `{nullptr, 0}` at the very end

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


More information about the Mlir-commits mailing list