[llvm] [ADT] Avoid repeated hash lookups (NFC) (PR #129355)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 28 20:11:02 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/129355
None
>From 47e52c387594d86e39b2ef8cdf1a4e38d7561188 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 27 Feb 2025 23:03:29 -0800
Subject: [PATCH] [ADT] Avoid repeated hash lookups (NFC)
---
llvm/include/llvm/ADT/SCCIterator.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
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