[LowerTypeTests] Append jump table aliases to llvm.used once (NFC) (#241146)
buildBitSetsFromFunctionsNative called appendToUsed for each
non-canonical, non-exported jump table alias. Each call rebuilt
llvm.used from scratch and left the old initializer behind as a dead
ConstantArray that still used all of its elements, so N aliases took
quadratic time and left O(N^2) dead uses on the aliases. Walking those
uses (e.g. in the verifier) cost a lot of build time.
Append the aliases just once after the loop instead. There's no change
to the output, but we remove the quadratic behavior. For a large
internal link with FullLTO and cross-DSO CFI, this change reduced the
overall link time from 24 minutes to 18 minutes, and peak RSS from 51
GiB to 28 GiB.
Assisted-by: Claude Opus 5.5
Co-authored-by: Nathan Lanza <nathanlanza@gmail.com>