[Mlir-commits] [clang] [llvm] [mlir] [mlir] Don't assume non-erased DenseMap entries remain valid after erase. NFC (PR #199365)

Mehdi Amini llvmlistbot at llvm.org
Sun May 24 03:40:20 PDT 2026


================
@@ -159,11 +156,12 @@ class ThreadLocalCache {
     }
     threadInstance.keepalive = perInstanceState;
 
-    // Before returning the new instance, take the chance to clear out any used
-    // entries in the static map. The cache is only cleared within the same
-    // thread to remove the need to lock the cache itself.
+    // Capture the value before clearing expired entries: clearExpiredEntries
+    // erases from `staticCache`, and backward-shift deletion can relocate the
+    // bucket referenced by `threadInstance`.
----------------
joker-eph wrote:

The previous comment was very contextual to the flow, describing the system-level behavior, the new comment seems like documenting some implementation trivia. Not clear to me why we lost the original comment here?

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


More information about the Mlir-commits mailing list