[llvm] [IR] Avoid repeated map lookups (NFC) (PR #128396)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 22 20:17:04 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/128396.diff
1 Files Affected:
- (modified) llvm/include/llvm/IR/ModuleSummaryIndexYAML.h (+1-2)
``````````diff
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h b/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
index b23fd4a72c93b..14b8ce5df8536 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
@@ -229,8 +229,7 @@ template <> struct CustomMappingTraits<GlobalValueSummaryMapTy> {
static_cast<GlobalValueSummary::ImportKind>(GVSum.ImportType));
if (GVSum.Aliasee) {
auto ASum = std::make_unique<AliasSummary>(GVFlags);
- if (!V.count(*GVSum.Aliasee))
- V.emplace(*GVSum.Aliasee, /*IsAnalysis=*/false);
+ V.try_emplace(*GVSum.Aliasee, /*IsAnalysis=*/false);
ValueInfo AliaseeVI(/*IsAnalysis=*/false, &*V.find(*GVSum.Aliasee));
// Note: Aliasee cannot be filled until all summaries are loaded.
// This is done in fixAliaseeLinks() which is called in
``````````
</details>
https://github.com/llvm/llvm-project/pull/128396
More information about the llvm-commits
mailing list