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

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 14 21:08:01 PDT 2025


================
@@ -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()) {
----------------
kuhar wrote:

Could we use `.contains(&Edge)`? with this type?

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


More information about the llvm-commits mailing list