[Mlir-commits] [mlir] [mlir][bytecode] Add support for deferred attribute/type parsing. (PR #170993)

Mehdi Amini llvmlistbot at llvm.org
Tue Dec 9 04:22:05 PST 2025


================
@@ -1239,68 +1304,110 @@ LogicalResult AttrTypeReader::initialize(
 
 template <typename T>
 T AttrTypeReader::resolveEntry(SmallVectorImpl<Entry<T>> &entries, size_t index,
-                               StringRef entryType) {
+                               StringRef entryType, uint64_t depth) {
   if (index >= entries.size()) {
     emitError(fileLoc) << "invalid " << entryType << " index: " << index;
     return {};
   }
 
-  // If the entry has already been resolved, there is nothing left to do.
-  Entry<T> &entry = entries[index];
-  if (entry.entry)
-    return entry.entry;
+  // Fast path: Try direct parsing without worklist overhead.
+  // This handles the common case where there are no deferred dependencies.
+  deferredWorklist.clear();
----------------
joker-eph wrote:

Shouldn't this be an `assert( deferredWorklist.empty());` here?

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


More information about the Mlir-commits mailing list