From 76c3661a04cac10d11d12bd96d0438096af252f8 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 22 Feb 2025 02:28:35 -0800 Subject: [PATCH] [DebugInfo] Avoid repeated hash lookups (NFC) --- llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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(); }); }