[llvm] [BOLT] Avoid repeated hash lookups (NFC) (PR #112073)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 11 20:19:37 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/112073
None
>From 262a2d6411d8dc2e1d31927a5b0658334255affd Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 11 Oct 2024 09:05:24 -0700
Subject: [PATCH] [BOLT] Avoid repeated hash lookups (NFC)
---
bolt/lib/Core/DIEBuilder.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/bolt/lib/Core/DIEBuilder.cpp b/bolt/lib/Core/DIEBuilder.cpp
index 69cfd58a1df04b..8d781fc5e04ff7 100644
--- a/bolt/lib/Core/DIEBuilder.cpp
+++ b/bolt/lib/Core/DIEBuilder.cpp
@@ -57,11 +57,9 @@ getDWOName(llvm::DWARFUnit &CU,
"DW_AT_dwo_name/DW_AT_GNU_dwo_name does not exist.");
if (DwarfOutputPath) {
DWOName = std::string(sys::path::filename(DWOName));
- auto Iter = NameToIndexMap.find(DWOName);
- if (Iter == NameToIndexMap.end())
- Iter = NameToIndexMap.insert({DWOName, 0}).first;
- DWOName.append(std::to_string(Iter->second));
- ++Iter->second;
+ uint32_t &Index = NameToIndexMap[DWOName];
+ DWOName.append(std::to_string(Index));
+ ++Index;
}
DWOName.append(".dwo");
return DWOName;
More information about the llvm-commits
mailing list