[llvm] 7a0c6cf - [CodeGen] Avoid repeated hash lookups (NFC) (#125160)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 31 07:51:12 PST 2025
Author: Kazu Hirata
Date: 2025-01-31T07:51:06-08:00
New Revision: 7a0c6cfdf3ec3715e963c94267a22d8d743826fd
URL: https://github.com/llvm/llvm-project/commit/7a0c6cfdf3ec3715e963c94267a22d8d743826fd
DIFF: https://github.com/llvm/llvm-project/commit/7a0c6cfdf3ec3715e963c94267a22d8d743826fd.diff
LOG: [CodeGen] Avoid repeated hash lookups (NFC) (#125160)
Added:
Modified:
llvm/lib/CodeGen/WindowScheduler.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/WindowScheduler.cpp b/llvm/lib/CodeGen/WindowScheduler.cpp
index f1658e36ae1e92..e7fc0d9a3d2548 100644
--- a/llvm/lib/CodeGen/WindowScheduler.cpp
+++ b/llvm/lib/CodeGen/WindowScheduler.cpp
@@ -356,8 +356,8 @@ void WindowScheduler::generateTripleMBB() {
// ==================================
// < Terminators >
// ==================================
- if (DefPairs.count(NewUse))
- NewUse = DefPairs[NewUse];
+ if (auto It = DefPairs.find(NewUse); It != DefPairs.end())
+ NewUse = It->second;
NewMI->substituteRegister(DefRegPair.first, NewUse, 0, *TRI);
}
// DefPairs is updated at last.
@@ -581,9 +581,10 @@ DenseMap<MachineInstr *, int> WindowScheduler::getIssueOrder(unsigned Offset,
DenseMap<MachineInstr *, int> IssueOrder;
int Id = 0;
for (int Cycle = 0; Cycle < (int)II; ++Cycle) {
- if (!CycleToMIs.count(Cycle))
+ auto It = CycleToMIs.find(Cycle);
+ if (It == CycleToMIs.end())
continue;
- for (auto *MI : CycleToMIs[Cycle])
+ for (auto *MI : It->second)
IssueOrder[MI] = Id++;
}
return IssueOrder;
More information about the llvm-commits
mailing list