[llvm] [TargetParser] Avoid repeated hash lookups (NFC) (PR #131555)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 16 20:23:45 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/131555.diff
1 Files Affected:
- (modified) llvm/lib/TargetParser/RISCVISAInfo.cpp (+3-2)
``````````diff
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);
});
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/131555
More information about the llvm-commits
mailing list