[llvm] [ADT] Avoid repeated hash lookups (NFC) (PR #131418)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 14 19:33:36 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/131418.diff


1 Files Affected:

- (modified) llvm/include/llvm/ADT/SCCIterator.h (+3-3) 


``````````diff
diff --git a/llvm/include/llvm/ADT/SCCIterator.h b/llvm/include/llvm/ADT/SCCIterator.h
index fef8cdb748442..64ee217eeed61 100644
--- a/llvm/include/llvm/ADT/SCCIterator.h
+++ b/llvm/include/llvm/ADT/SCCIterator.h
@@ -366,9 +366,9 @@ scc_member_iterator<GraphT, GT>::scc_member_iterator(
     Queue.pop();
     Nodes.push_back(Node);
     for (auto &Edge : Node->Edges) {
-      NodeInfoMap[Edge.Target].IncomingMSTEdges.erase(&Edge);
-      if (MSTEdges.count(&Edge) &&
-          NodeInfoMap[Edge.Target].IncomingMSTEdges.empty()) {
+      NodeInfo &Info = NodeInfoMap[Edge.Target];
+      Info.IncomingMSTEdges.erase(&Edge);
+      if (MSTEdges.count(&Edge) && Info.IncomingMSTEdges.empty()) {
         Queue.push(Edge.Target);
       }
     }

``````````

</details>


https://github.com/llvm/llvm-project/pull/131418


More information about the llvm-commits mailing list