aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-02-17 01:32:25 -0800
committerGitHub <noreply@github.com>2025-02-17 01:32:25 -0800
commitfb14638817004dc96c9401d7f704d7e5cd0ef3fc (patch)
treed49cab1f0495da95d3e09faf4c0b77531bc958c8
parentff4e21fccc439085f6381076a2ac7d9fa371ab29 (diff)
downloadllvm-fb14638817004dc96c9401d7f704d7e5cd0ef3fc.zip
llvm-fb14638817004dc96c9401d7f704d7e5cd0ef3fc.tar.gz
llvm-fb14638817004dc96c9401d7f704d7e5cd0ef3fc.tar.bz2
[DebugInfo] Avoid repeated hash lookups (NFC) (#127446)
-rw-r--r--llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp
index 932346e..513b0d3 100644
--- a/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp
@@ -65,20 +65,24 @@ LVSectionIndex LVSymbolTable::update(LVScope *Function) {
Name = Function->getName();
std::string SymbolName(Name);
- if (SymbolName.empty() || (SymbolNames.find(SymbolName) == SymbolNames.end()))
+ if (SymbolName.empty())
+ return SectionIndex;
+
+ auto It = SymbolNames.find(SymbolName);
+ if (It == SymbolNames.end())
return SectionIndex;
// Update a recorded entry with its logical scope, only if the scope has
// ranges. That is the case when in DWARF there are 2 DIEs connected via
// the DW_AT_specification.
if (Function->getHasRanges()) {
- SymbolNames[SymbolName].Scope = Function;
- SectionIndex = SymbolNames[SymbolName].SectionIndex;
+ It->second.Scope = Function;
+ SectionIndex = It->second.SectionIndex;
} else {
SectionIndex = UndefinedSectionIndex;
}
- if (SymbolNames[SymbolName].IsComdat)
+ if (It->second.IsComdat)
Function->setIsComdat();
LLVM_DEBUG({ print(dbgs()); });