Skip to content

Commit fb14638

Browse files
[DebugInfo] Avoid repeated hash lookups (NFC) (llvm#127446)
1 parent ff4e21f commit fb14638

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,24 @@ LVSectionIndex LVSymbolTable::update(LVScope *Function) {
6565
Name = Function->getName();
6666
std::string SymbolName(Name);
6767

68-
if (SymbolName.empty() || (SymbolNames.find(SymbolName) == SymbolNames.end()))
68+
if (SymbolName.empty())
69+
return SectionIndex;
70+
71+
auto It = SymbolNames.find(SymbolName);
72+
if (It == SymbolNames.end())
6973
return SectionIndex;
7074

7175
// Update a recorded entry with its logical scope, only if the scope has
7276
// ranges. That is the case when in DWARF there are 2 DIEs connected via
7377
// the DW_AT_specification.
7478
if (Function->getHasRanges()) {
75-
SymbolNames[SymbolName].Scope = Function;
76-
SectionIndex = SymbolNames[SymbolName].SectionIndex;
79+
It->second.Scope = Function;
80+
SectionIndex = It->second.SectionIndex;
7781
} else {
7882
SectionIndex = UndefinedSectionIndex;
7983
}
8084

81-
if (SymbolNames[SymbolName].IsComdat)
85+
if (It->second.IsComdat)
8286
Function->setIsComdat();
8387

8488
LLVM_DEBUG({ print(dbgs()); });

0 commit comments

Comments
 (0)