Skip to content

Commit 55dd29c

Browse files
[llvm-profdata] Avoid repeated hash lookups (NFC) (#111629)
1 parent 3dba4ca commit 55dd29c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/tools/llvm-profdata/llvm-profdata.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,11 +1220,9 @@ adjustInstrProfile(std::unique_ptr<WriterContext> &WC,
12201220
}
12211221
}
12221222

1223-
if (!StaticFuncMap.contains(NewName)) {
1224-
StaticFuncMap[NewName] = Name;
1225-
} else {
1226-
StaticFuncMap[NewName] = DuplicateNameStr;
1227-
}
1223+
auto [It, Inserted] = StaticFuncMap.try_emplace(NewName, Name);
1224+
if (!Inserted)
1225+
It->second = DuplicateNameStr;
12281226
};
12291227

12301228
// We need to flatten the SampleFDO profile as the InstrFDO

0 commit comments

Comments
 (0)