[llvm] 9dd8c14 - [IR] Avoid repeated map lookups (NFC) (#128396)

via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 23 01:03:48 PST 2025


Author: Kazu Hirata
Date: 2025-02-23T01:03:46-08:00
New Revision: 9dd8c1444371c2df39b882ab6962b225f08be1ea

URL: https://github.com/llvm/llvm-project/commit/9dd8c1444371c2df39b882ab6962b225f08be1ea
DIFF: https://github.com/llvm/llvm-project/commit/9dd8c1444371c2df39b882ab6962b225f08be1ea.diff

LOG: [IR] Avoid repeated map lookups (NFC) (#128396)

Added: 
    

Modified: 
    llvm/include/llvm/IR/ModuleSummaryIndexYAML.h

Removed: 
    


################################################################################
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


        


More information about the llvm-commits mailing list