diff options
author | Nikita Popov <npopov@redhat.com> | 2024-06-27 17:00:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-27 17:00:21 +0200 |
commit | 42c3edb4819ff2e9608f645fb5793dcb33b47f9c (patch) | |
tree | 1ae78d5fd07bcd7a8f6980b2310d742f07f818f9 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | 8a7730fb88445a019fe150d5db4f6642e43afd04 (diff) | |
download | llvm-42c3edb4819ff2e9608f645fb5793dcb33b47f9c.zip llvm-42c3edb4819ff2e9608f645fb5793dcb33b47f9c.tar.gz llvm-42c3edb4819ff2e9608f645fb5793dcb33b47f9c.tar.bz2 |
[SmallPtrSet] Don't leave tombstones in small mode (#96762)
When erasing elements in small mode, we currently leave behind
tombstones. This means that insertion into the SmallPtrSet also has to
check for these, making the operation more expensive than it really
should be.
We don't really need the tombstones in small mode, because we can just
replace with the last element in the set instead. This changes the
order, but SmallPtrSet order is fundamentally unstable anyway.
However, not leaving tombstones means that the erase() operation now
invalidates iterators. This means that consumers that want to remove
elements while iterating over the set have to use remove_if() instead.
If they fail to do so, there will be an assertion failure thanks to
debug epochs, so any such cases are easy to detect (and I have already
fixed all cases inside llvm at least).
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
0 files changed, 0 insertions, 0 deletions