Skip to content

Commit b192f20

Browse files
[BOLT] Avoid repeated hash lookups (NFC) (#112073)
1 parent abb594b commit b192f20

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

bolt/lib/Core/DIEBuilder.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,9 @@ getDWOName(llvm::DWARFUnit &CU,
5757
"DW_AT_dwo_name/DW_AT_GNU_dwo_name does not exist.");
5858
if (DwarfOutputPath) {
5959
DWOName = std::string(sys::path::filename(DWOName));
60-
auto Iter = NameToIndexMap.find(DWOName);
61-
if (Iter == NameToIndexMap.end())
62-
Iter = NameToIndexMap.insert({DWOName, 0}).first;
63-
DWOName.append(std::to_string(Iter->second));
64-
++Iter->second;
60+
uint32_t &Index = NameToIndexMap[DWOName];
61+
DWOName.append(std::to_string(Index));
62+
++Index;
6563
}
6664
DWOName.append(".dwo");
6765
return DWOName;

0 commit comments

Comments
 (0)