aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-09-13 10:41:45 -0700
committerGitHub <noreply@github.com>2024-09-13 10:41:45 -0700
commit3a274584ebbcad6500efc4083bb53c1af565e294 (patch)
treee5315c45f66c177f926f3af9aa63f2d81d6075ab /llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
parent0351dc522a25df0473a63b414a5bfde5814d3dc3 (diff)
downloadllvm-3a274584ebbcad6500efc4083bb53c1af565e294.zip
llvm-3a274584ebbcad6500efc4083bb53c1af565e294.tar.gz
llvm-3a274584ebbcad6500efc4083bb53c1af565e294.tar.bz2
[LiveDebugValues] Avoid repeated hash lookups (NFC) (#108484)
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index a69dbbb..a73a3aa 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -2231,11 +2231,9 @@ void InstrRefBasedLDV::accumulateFragmentMap(MachineInstr &MI) {
// If this is the first sighting of this variable, then we are guaranteed
// there are currently no overlapping fragments either. Initialize the set
// of seen fragments, record no overlaps for the current one, and return.
- auto SeenIt = SeenFragments.find(MIVar.getVariable());
- if (SeenIt == SeenFragments.end()) {
- SmallSet<FragmentInfo, 4> OneFragment;
- OneFragment.insert(ThisFragment);
- SeenFragments.insert({MIVar.getVariable(), OneFragment});
+ auto [SeenIt, Inserted] = SeenFragments.try_emplace(MIVar.getVariable());
+ if (Inserted) {
+ SeenIt->second.insert(ThisFragment);
OverlapFragments.insert({{MIVar.getVariable(), ThisFragment}, {}});
return;