Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@kazutakahirata kazutakahirata requested a review from nikic March 1, 2025 04:10
@llvmbot
Copy link
Member

llvmbot commented Mar 1, 2025

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

Changes

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

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/SCCIterator.h (+3-3)
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;
     }
   }
 

@kazutakahirata kazutakahirata merged commit 8d1f385 into llvm:main Mar 1, 2025
11 of 13 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_lookups_llvm_ADT branch March 1, 2025 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants