[llvm] 8d1f385 - [ADT] Avoid repeated hash lookups (NFC) (#129355)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 21:03:39 PST 2025


Author: Kazu Hirata
Date: 2025-02-28T21:03:35-08:00
New Revision: 8d1f385d40634fcffabe701334efb90c57243636

URL: https://github.com/llvm/llvm-project/commit/8d1f385d40634fcffabe701334efb90c57243636
DIFF: https://github.com/llvm/llvm-project/commit/8d1f385d40634fcffabe701334efb90c57243636.diff

LOG: [ADT] Avoid repeated hash lookups (NFC) (#129355)

Added: 
    

Modified: 
    llvm/include/llvm/ADT/SCCIterator.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/SCCIterator.h b/llvm/include/llvm/ADT/SCCIterator.h
index 3bd103c13f19f..fef8cdb748442 100644
--- a/llvm/include/llvm/ADT/SCCIterator.h
+++ b/llvm/include/llvm/ADT/SCCIterator.h
@@ -354,10 +354,10 @@ scc_member_iterator<GraphT, GT>::scc_member_iterator(
   // Walk through SortedEdges to initialize the queue, instead of using NodeInfoMap
   // to ensure an ordered deterministic push.
   for (auto *Edge : SortedEdges) {
-    if (!NodeInfoMap[Edge->Source].Visited &&
-        NodeInfoMap[Edge->Source].IncomingMSTEdges.empty()) {
+    auto &Info = NodeInfoMap[Edge->Source];
+    if (!Info.Visited && Info.IncomingMSTEdges.empty()) {
       Queue.push(Edge->Source);
-      NodeInfoMap[Edge->Source].Visited = true;
+      Info.Visited = true;
     }
   }
 


        


More information about the llvm-commits mailing list