[llvm] [StringMap] Add remove_if and use it for erase-while-iterating (PR #202272)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 7 23:56:18 PDT 2026
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/202272
Add a `remove_if` member to StringMap (and to HashKeyMap, the base of
SampleProfileMap) as a replacement for the erase-while-iterating idiom,
and convert the two in-tree users: SymbolStringPool::clearDeadEntries
and llvm-profdata's filterFunctions (a template over StringMap and
SampleProfileMap).
Extracted from #202237 - making StringMap's mutation invalidates iterators
so that we can remove the tombstone state.
Aided by Claude Opus 4.8
<html><body><h1>504 Gateway Time-out</h1>
The server didn't respond in time.
</body></html>
More information about the llvm-commits
mailing list