aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-09-21 09:11:19 -0700
committerGitHub <noreply@github.com>2024-09-21 09:11:19 -0700
commit22486e031d13cad3df99be5ab6d860920b71fc80 (patch)
tree276b44633fee8e0b605c4b5cf76f0a7238257098 /llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
parent8d0336c14be9d1f99e5c2b5791d8f4df35725ff2 (diff)
downloadllvm-22486e031d13cad3df99be5ab6d860920b71fc80.zip
llvm-22486e031d13cad3df99be5ab6d860920b71fc80.tar.gz
llvm-22486e031d13cad3df99be5ab6d860920b71fc80.tar.bz2
[LiveDebugValues] Avoid repeated hash lookups (NFC) (#109509)
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
index 2d95ff9e..7e7d90f 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
@@ -1952,11 +1952,9 @@ void VarLocBasedLDV::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);
OverlappingFragments.insert({{MIVar.getVariable(), ThisFragment}, {}});
return;