[llvm] [TargetParser] Avoid repeated hash lookups (NFC) (PR #131555)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 16 20:23:12 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/131555
None
>From e2363ea860e41be2bbd3930de45827c268702231 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 16 Mar 2025 09:38:52 -0700
Subject: [PATCH] [TargetParser] Avoid repeated hash lookups (NFC)
---
llvm/lib/TargetParser/RISCVISAInfo.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index ecd397f451c79..f7b487688d352 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -839,10 +839,11 @@ void RISCVISAInfo::updateImplication() {
std::for_each(Range.first, Range.second,
[&](const ImpliedExtsEntry &Implied) {
const char *ImpliedExt = Implied.ImpliedExt;
- if (Exts.count(ImpliedExt))
+ auto [It, Inserted] = Exts.try_emplace(ImpliedExt);
+ if (!Inserted)
return;
auto Version = findDefaultVersion(ImpliedExt);
- Exts[ImpliedExt] = *Version;
+ It->second = *Version;
WorkList.push_back(ImpliedExt);
});
}
More information about the llvm-commits
mailing list