Skip to content

Commit 09bf5b0

Browse files
[CodeGen] Avoid repeated hash lookups (NFC) (#123160)
1 parent 5fa989b commit 09bf5b0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/CodeGen/MachineCSE.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -832,12 +832,11 @@ bool MachineCSEImpl::ProcessBlockPRE(MachineDominatorTree *DT,
832832
if (!isPRECandidate(&MI, PhysRefs))
833833
continue;
834834

835-
if (!PREMap.count(&MI)) {
836-
PREMap[&MI] = MBB;
835+
auto [It, Inserted] = PREMap.try_emplace(&MI, MBB);
836+
if (Inserted)
837837
continue;
838-
}
839838

840-
auto MBB1 = PREMap[&MI];
839+
auto *MBB1 = It->second;
841840
assert(
842841
!DT->properlyDominates(MBB, MBB1) &&
843842
"MBB cannot properly dominate MBB1 while DFS through dominators tree!");

0 commit comments

Comments
 (0)