[llvm-jitlink] Avoid repeated hash lookups (NFC) (#129993)

This commit is contained in:
Kazu Hirata
2025-03-06 08:50:21 -08:00
committed by GitHub
parent abcab4f7ba
commit 92dfc0ffc3

View File

@@ -104,14 +104,15 @@ Error registerELFGraphInfo(Session &S, LinkGraph &G) {
std::lock_guard<std::mutex> Lock(S.M);
auto FileName = sys::path::filename(G.getName());
if (S.FileInfos.count(FileName)) {
auto [It, Inserted] = S.FileInfos.try_emplace(FileName);
if (!Inserted) {
return make_error<StringError>("When -check is passed, file names must be "
"distinct (duplicate: \"" +
FileName + "\")",
inconvertibleErrorCode());
}
auto &FileInfo = S.FileInfos[FileName];
auto &FileInfo = It->second;
LLVM_DEBUG({
dbgs() << "Registering ELF file info for \"" << FileName << "\"\n";
});