[llvm] 0e5826e - [IPO] Avoid repeated hash lookups (NFC) (#129467)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 3 01:03:21 PST 2025


Author: Kazu Hirata
Date: 2025-03-03T01:03:18-08:00
New Revision: 0e5826ea07b17d05d6ea5a397288e9cc96f1d8cd

URL: https://github.com/llvm/llvm-project/commit/0e5826ea07b17d05d6ea5a397288e9cc96f1d8cd
DIFF: https://github.com/llvm/llvm-project/commit/0e5826ea07b17d05d6ea5a397288e9cc96f1d8cd.diff

LOG: [IPO] Avoid repeated hash lookups (NFC) (#129467)

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/FunctionAttrs.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 5c17b9e8d386d..6fe81f7b063ec 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -319,8 +319,9 @@ static FunctionSummary *calculatePrevailingSummary(
     function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
         IsPrevailing) {
 
-  if (CachedPrevailingSummary.count(VI))
-    return CachedPrevailingSummary[VI];
+  if (auto It = CachedPrevailingSummary.find(VI);
+      It != CachedPrevailingSummary.end())
+    return It->second;
 
   /// At this point, prevailing symbols have been resolved. The following leads
   /// to returning a conservative result:


        


More information about the llvm-commits mailing list