[llvm] [llvm-nm] Improve performance while faking symbols from function starts (PR #162755)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 9 18:08:07 PDT 2025
================
@@ -1615,12 +1616,11 @@ static void dumpSymbolsFromDLInfoMachO(MachOObjectFile &MachO,
}
// See if these addresses are already in the symbol table.
unsigned FunctionStartsAdded = 0;
+ SmallSet<uint64_t, 32> SymbolAddresses;
+ for (unsigned J = 0; J < SymbolList.size(); ++J)
+ SymbolAddresses.insert(SymbolList[J].Address);
for (uint64_t f = 0; f < FoundFns.size(); f++) {
- bool found = false;
- for (unsigned J = 0; J < SymbolList.size() && !found; ++J) {
- if (SymbolList[J].Address == FoundFns[f] + BaseSegmentAddress)
- found = true;
- }
+ bool found = SymbolAddresses.contains(FoundFns[f] + BaseSegmentAddress);
// See this address is not already in the symbol table fake up an
// nlist for it.
if (!found) {
----------------
ellishg wrote:
Might as wel inline `found` into this if statement
https://github.com/llvm/llvm-project/pull/162755
More information about the llvm-commits
mailing list