Skip to content

Commit 40c65e8

Browse files
[CodeGen] Avoid repeated hash lookups (NFC) (#129821)
1 parent 8981298 commit 40c65e8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/lib/CodeGen/MachineScheduler.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,10 +2032,11 @@ void BaseMemOpClusterMutation::clusterNeighboringMemOps(
20322032
unsigned ClusterLength = 2;
20332033
unsigned CurrentClusterBytes = MemOpa.Width.getValue().getKnownMinValue() +
20342034
MemOpb.Width.getValue().getKnownMinValue();
2035-
if (SUnit2ClusterInfo.count(MemOpa.SU->NodeNum)) {
2036-
ClusterLength = SUnit2ClusterInfo[MemOpa.SU->NodeNum].first + 1;
2037-
CurrentClusterBytes = SUnit2ClusterInfo[MemOpa.SU->NodeNum].second +
2038-
MemOpb.Width.getValue().getKnownMinValue();
2035+
auto It = SUnit2ClusterInfo.find(MemOpa.SU->NodeNum);
2036+
if (It != SUnit2ClusterInfo.end()) {
2037+
const auto &[Len, Bytes] = It->second;
2038+
ClusterLength = Len + 1;
2039+
CurrentClusterBytes = Bytes + MemOpb.Width.getValue().getKnownMinValue();
20392040
}
20402041

20412042
if (!TII->shouldClusterMemOps(MemOpa.BaseOps, MemOpa.Offset,

0 commit comments

Comments
 (0)