Skip to content

Commit 22486e0

Browse files
[LiveDebugValues] Avoid repeated hash lookups (NFC) (#109509)
1 parent 8d0336c commit 22486e0

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,11 +1952,9 @@ void VarLocBasedLDV::accumulateFragmentMap(MachineInstr &MI,
19521952
// If this is the first sighting of this variable, then we are guaranteed
19531953
// there are currently no overlapping fragments either. Initialize the set
19541954
// of seen fragments, record no overlaps for the current one, and return.
1955-
auto SeenIt = SeenFragments.find(MIVar.getVariable());
1956-
if (SeenIt == SeenFragments.end()) {
1957-
SmallSet<FragmentInfo, 4> OneFragment;
1958-
OneFragment.insert(ThisFragment);
1959-
SeenFragments.insert({MIVar.getVariable(), OneFragment});
1955+
auto [SeenIt, Inserted] = SeenFragments.try_emplace(MIVar.getVariable());
1956+
if (Inserted) {
1957+
SeenIt->second.insert(ThisFragment);
19601958

19611959
OverlappingFragments.insert({{MIVar.getVariable(), ThisFragment}, {}});
19621960
return;

0 commit comments

Comments
 (0)