diff options
author | Fangrui Song <i@maskray.me> | 2021-02-23 15:50:45 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2021-02-23 16:09:05 -0800 |
commit | 3adb89bb9f8e73c82787babb2f877fece7394770 (patch) | |
tree | 1d49b99ee5228ce78a585b1b7efeca1827c9ecf7 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 0a5949dcfa31d599353fb4ccf4d207bdae7c7281 (diff) | |
download | llvm-3adb89bb9f8e73c82787babb2f877fece7394770.zip llvm-3adb89bb9f8e73c82787babb2f877fece7394770.tar.gz llvm-3adb89bb9f8e73c82787babb2f877fece7394770.tar.bz2 |
[ThinLTO] Make cloneUsedGlobalVariables deterministic
Iterating on `SmallPtrSet<GlobalValue *, 8>` with more than 8 elements
is not deterministic. Use a SmallVector instead because `Used` is guaranteed to contain unique elements.
While here, decrease inline element counts from 8 to 4. The number of
`llvm.used`/`llvm.compiler.used` elements is usually 0 or 1. For full
LTO/hybrid LTO, the number may be large, so we need to be careful.
According to tejohnson's analysis https://reviews.llvm.org/D97128#2582399 , 4 is
good for a large project with WholeProgramDevirt, when available_externally
vtables are placed in the llvm.compiler.used set.
Differential Revision: https://reviews.llvm.org/D97128
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions