[Mlir-commits] [mlir] [MLIR] Fix duplicated attribute nodes in MLIR bytecode deserialization (PR #151267)

Christian Ulmann llvmlistbot at llvm.org
Sun Aug 24 23:40:17 PDT 2025


================
@@ -245,6 +245,15 @@ static Symbol parseExtendedSymbol(Parser &p, AsmParserState *asmState,
       return nullptr;
   }
 
+  if constexpr (std::is_same_v<Symbol, Attribute>) {
+    auto &cache = p.getState().symbols.attributesCache;
+    auto cacheIt = cache.find(symbolData);
+    // Skip cached attribute if it has type.
+    if (cacheIt != cache.end() && !p.getToken().is(Token::colon))
+      return cacheIt->second;
+
+    return cache[symbolData] = createSymbol(dialectName, symbolData, loc);
----------------
Dinistro wrote:

You cannot rely on the `symbolData` alone here. This needs to also include the dialects namespace. 

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


More information about the Mlir-commits mailing list