Skip to content

Commit 71cceb1

Browse files
[CodeGen] Avoid repeated hash lookups (NFC) (#126852)
1 parent df09290 commit 71cceb1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/include/llvm/CodeGen/MachinePipeliner.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,10 @@ class NodeSet {
468468
SUnit *SuccSUnit = Succ.getDst();
469469
if (V != SuccSUnit)
470470
continue;
471-
if (SUnitToDistance[U] + Succ.getLatency() > SUnitToDistance[V]) {
472-
SUnitToDistance[V] = SUnitToDistance[U] + Succ.getLatency();
473-
}
471+
unsigned &DU = SUnitToDistance[U];
472+
unsigned &DV = SUnitToDistance[V];
473+
if (DU + Succ.getLatency() > DV)
474+
DV = DU + Succ.getLatency();
474475
}
475476
}
476477
// Handle a back-edge in loop carried dependencies

0 commit comments

Comments
 (0)