[llvm] [DebugInfo] Avoid repeated hash lookups (NFC) (PR #112298)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 14 20:29:24 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-debuginfo
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/112298.diff
1 Files Affected:
- (modified) llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp (+3-3)
``````````diff
diff --git a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
index 1a31aa206dfcc6..463b9ebe3cbff5 100644
--- a/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp
@@ -447,11 +447,11 @@ SymbolCache::findPublicSymbolBySectOffset(uint32_t Sect, uint32_t Offset) {
std::vector<SymbolCache::LineTableEntry>
SymbolCache::findLineTable(uint16_t Modi) const {
// Check if this module has already been added.
- auto LineTableIter = LineTable.find(Modi);
- if (LineTableIter != LineTable.end())
+ auto [LineTableIter, Inserted] = LineTable.try_emplace(Modi);
+ if (!Inserted)
return LineTableIter->second;
- std::vector<LineTableEntry> &ModuleLineTable = LineTable[Modi];
+ std::vector<LineTableEntry> &ModuleLineTable = LineTableIter->second;
// If there is an error or there are no lines, just return the
// empty vector.
``````````
</details>
https://github.com/llvm/llvm-project/pull/112298
More information about the llvm-commits
mailing list