[llvm] [DebugInfo] Avoid repeated hash lookups (NFC) (PR #128395)

via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 22 20:16:35 PST 2025


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/128395.diff


1 Files Affected:

- (modified) llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp (+3-2) 


``````````diff
diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp
index 2433fa5016b88..6ce9bcbeb13c0 100644
--- a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp
@@ -162,11 +162,12 @@ void LVCodeViewReader::cacheRelocations() {
   for (const SectionRef &Section : getObj().sections()) {
     const coff_section *CoffSection = getObj().getCOFFSection(Section);
 
+    auto &RM = RelocMap[CoffSection];
     for (const RelocationRef &Relocacion : Section.relocations())
-      RelocMap[CoffSection].push_back(Relocacion);
+      RM.push_back(Relocacion);
 
     // Sort relocations by address.
-    llvm::sort(RelocMap[CoffSection], [](RelocationRef L, RelocationRef R) {
+    llvm::sort(RM, [](RelocationRef L, RelocationRef R) {
       return L.getOffset() < R.getOffset();
     });
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/128395


More information about the llvm-commits mailing list