diff options
author | Daniel RodrÃguez Troitiño <danielrodriguez@meta.com> | 2025-10-11 20:45:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-11 20:45:47 -0700 |
commit | 3f46a5cf438ce6eaad406b8780289ee9b8a6941a (patch) | |
tree | 2ae3abe6751d321fc87eac6647ad3231a252e014 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 78b363ce1d35e8617c79e9c85acb4ac5db044082 (diff) | |
download | llvm-3f46a5cf438ce6eaad406b8780289ee9b8a6941a.zip llvm-3f46a5cf438ce6eaad406b8780289ee9b8a6941a.tar.gz llvm-3f46a5cf438ce6eaad406b8780289ee9b8a6941a.tar.bz2 |
[llvm-nm] Improve performance while faking symbols from function starts (#162755)
By default `nm` will look into `LC_FUNCTION_STARTS` for binaries that
have the flag `MH_NLIST_OUTOFSYNC_WITH_DYLDINFO` set unless
`--no-dyldinfo` flag is passed.
The implementation that looked for those `LC_FUNCTION_STARTS` in the
symbol list was a double nested loop that checked the symbol list over
and over again for each of the `LC_FUNCTION_STARTS` entries. For
binaries with couple million function starts and hundreds of thousands
of symbols, the double nested loop doesn't seem to finish and takes
hours even in powerful machines.
Instead of the nested loop, exchange time for memory and add all the
addresses of the symbols into a set that can be checked then for each of
the `LC_FUNCTION_STARTS` very quickly. What took hours and hours and did
not seem to finish now takes less than 10 seconds.
Fixes #93944
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions