aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineCSE.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-01-16 08:45:53 -0800
committerGitHub <noreply@github.com>2025-01-16 08:45:53 -0800
commit09bf5b0d3560992553b593b774c2d3dfff1cd683 (patch)
tree61d53cd0378bba77914eeca66b258ef4caf5e36e /llvm/lib/CodeGen/MachineCSE.cpp
parent5fa989b034236ebf5a808dd47af50ab29d991a7d (diff)
downloadllvm-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.cpp7
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!");