Files
clang-p2996/llvm/unittests/ADT/SmallPtrSetTest.cpp
Jeremy Morse 719557269e [SSAUpdater] Add a SmallPtrSet reserve method for IDFcalc (#97823)
As per the LLVM programmers manual, SmallPtrSets do linear scans on
insertion and then turn into a hash-table if the set gets big. Here in
the IDFCalculator, the SmallPtrSets have been configured to have 32
elements in each static allocation... which means that we linearly scan
for all problems with up to 32 elements, which I feel is quite a large
N.

Shorten the SmallPtrSet size, and add a reserve method to avoid any
repeated allocations, plus corresponding unit tests. Doing this yields a
0.13% compile-time improvement for debug-info builds, as we hit
IDFCalculator pretty hard in InstrRefBasedLDV.
2024-08-08 11:35:40 +01:00

12 KiB