[llvm] 67a631b - [CodeGen] Avoid repeated hash lookups (NFC) (#132329)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 21 08:00:49 PDT 2025
Author: Kazu Hirata
Date: 2025-03-21T08:00:45-07:00
New Revision: 67a631b40673ed061abcb842feb840d982dfc6d9
URL: https://github.com/llvm/llvm-project/commit/67a631b40673ed061abcb842feb840d982dfc6d9
DIFF: https://github.com/llvm/llvm-project/commit/67a631b40673ed061abcb842feb840d982dfc6d9.diff
LOG: [CodeGen] Avoid repeated hash lookups (NFC) (#132329)
Added:
Modified:
llvm/lib/CodeGen/StackColoring.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp
index 552dfdfe16ce4..0f93822d9792b 100644
--- a/llvm/lib/CodeGen/StackColoring.cpp
+++ b/llvm/lib/CodeGen/StackColoring.cpp
@@ -1178,8 +1178,11 @@ void StackColoring::expungeSlotMap(DenseMap<int, int> &SlotRemap,
if (auto It = SlotRemap.find(i); It != SlotRemap.end()) {
int Target = It->second;
// As long as our target is mapped to something else, follow it.
- while (SlotRemap.count(Target)) {
- Target = SlotRemap[Target];
+ while (true) {
+ auto It = SlotRemap.find(Target);
+ if (It == SlotRemap.end())
+ break;
+ Target = It->second;
SlotRemap[i] = Target;
}
}
More information about the llvm-commits
mailing list