[llvm] 7cd3047 - [IPO] Avoid repeated hash lookups (NFC) (#130462)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 9 00:48:00 PST 2025


Author: Kazu Hirata
Date: 2025-03-09T00:47:57-08:00
New Revision: 7cd304725263a6f58d61aede6c0b6c08c042d200

URL: https://github.com/llvm/llvm-project/commit/7cd304725263a6f58d61aede6c0b6c08c042d200
DIFF: https://github.com/llvm/llvm-project/commit/7cd304725263a6f58d61aede6c0b6c08c042d200.diff

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

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 6fe81f7b063ec..1fca1b54065d4 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -406,15 +406,16 @@ static FunctionSummary *calculatePrevailingSummary(
     }
   }
 
+  auto &CPS = CachedPrevailingSummary[VI];
   if (Local) {
     assert(!Prevailing);
-    CachedPrevailingSummary[VI] = Local;
+    CPS = Local;
   } else if (Prevailing) {
     assert(!Local);
-    CachedPrevailingSummary[VI] = Prevailing;
+    CPS = Prevailing;
   }
 
-  return CachedPrevailingSummary[VI];
+  return CPS;
 }
 
 bool llvm::thinLTOPropagateFunctionAttrs(


        


More information about the llvm-commits mailing list