diff options
author | Kazu Hirata <kazu@google.com> | 2025-01-16 08:45:53 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-16 08:45:53 -0800 |
commit | 09bf5b0d3560992553b593b774c2d3dfff1cd683 (patch) | |
tree | 61d53cd0378bba77914eeca66b258ef4caf5e36e /llvm/lib/CodeGen/MachineCSE.cpp | |
parent | 5fa989b034236ebf5a808dd47af50ab29d991a7d (diff) | |
download | llvm-09bf5b0d3560992553b593b774c2d3dfff1cd683.zip llvm-09bf5b0d3560992553b593b774c2d3dfff1cd683.tar.gz llvm-09bf5b0d3560992553b593b774c2d3dfff1cd683.tar.bz2 |
[CodeGen] Avoid repeated hash lookups (NFC) (#123160)
Diffstat (limited to 'llvm/lib/CodeGen/MachineCSE.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineCSE.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineCSE.cpp b/llvm/lib/CodeGen/MachineCSE.cpp index 0a54705..728fd2f 100644 --- a/llvm/lib/CodeGen/MachineCSE.cpp +++ b/llvm/lib/CodeGen/MachineCSE.cpp @@ -832,12 +832,11 @@ bool MachineCSEImpl::ProcessBlockPRE(MachineDominatorTree *DT, if (!isPRECandidate(&MI, PhysRefs)) continue; - if (!PREMap.count(&MI)) { - PREMap[&MI] = MBB; + auto [It, Inserted] = PREMap.try_emplace(&MI, MBB); + if (Inserted) continue; - } - auto MBB1 = PREMap[&MI]; + auto *MBB1 = It->second; assert( !DT->properlyDominates(MBB, MBB1) && "MBB cannot properly dominate MBB1 while DFS through dominators tree!"); |