[Mlir-commits] [mlir] [mlir][Printer] Honor --mlir-elide-resource-strings-if-larger when serializing of large blobs (PR #213920)

Natanael Cintean llvmlistbot at llvm.org
Tue Aug 4 07:28:21 PDT 2026


================
@@ -31,11 +60,44 @@
 // ZERO-EMPTY:
 // ZERO-NEXT: #-}
 
+// At the exact boundary (limit == blob3's exact size) blob3 must still be printed,
+// since the sizeHint fast-path only elides when size is strictly greater than the limit.
+// BOUND14:      {-#
+// BOUND14-NEXT:   dialect_resources: {
+// BOUND14-NEXT:     builtin: {
+// BOUND14-NEXT:       blob3: "0x0800000001"
+// BOUND14-NEXT:     }
+// BOUND14-NEXT:   },
+// BOUND14-NEXT:   external_resources: {
+// BOUND14-NEXT:     external: {
+// BOUND14-NEXT:       "backslash\\tab\09": true,
+// BOUND14-NEXT:       string: "\22string\22"
+// BOUND14-NEXT:     },
+// BOUND14-NEXT:     other_stuff: {
+// BOUND14-NEXT:       bool: true
+// BOUND14-NEXT:     }
+// BOUND14-NEXT:   }
+// BOUND14-NEXT: #-}
+
+// One below the boundary, blob3 is elided and no dialect_resources dict is emitted.
----------------
natanael-cintean wrote:

I kept the same elision logic, either elide entirely if res > limit or print.
I could implement this new approach, but it might cause issues with users who expect the previous logic.  In any case I think it would be better to have it with a separate PR, if you agree.

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


More information about the Mlir-commits mailing list