[llvm] 09bf5b0 - [CodeGen] Avoid repeated hash lookups (NFC) (#123160)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 16 08:45:57 PST 2025
Author: Kazu Hirata
Date: 2025-01-16T08:45:53-08:00
New Revision: 09bf5b0d3560992553b593b774c2d3dfff1cd683
URL: https://github.com/llvm/llvm-project/commit/09bf5b0d3560992553b593b774c2d3dfff1cd683
DIFF: https://github.com/llvm/llvm-project/commit/09bf5b0d3560992553b593b774c2d3dfff1cd683.diff
LOG: [CodeGen] Avoid repeated hash lookups (NFC) (#123160)
Added:
Modified:
llvm/lib/CodeGen/MachineCSE.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MachineCSE.cpp b/llvm/lib/CodeGen/MachineCSE.cpp
index 0a547050e91a8a..728fd2f5f7cd4f 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!");
More information about the llvm-commits
mailing list