Skip to content

Commit 8fd8fd5

Browse files
[LiveDebugValues] Avoid repeated hash lookups (NFC)
1 parent 4a9b6b0 commit 8fd8fd5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,11 +2231,9 @@ void InstrRefBasedLDV::accumulateFragmentMap(MachineInstr &MI) {
22312231
// If this is the first sighting of this variable, then we are guaranteed
22322232
// there are currently no overlapping fragments either. Initialize the set
22332233
// of seen fragments, record no overlaps for the current one, and return.
2234-
auto SeenIt = SeenFragments.find(MIVar.getVariable());
2235-
if (SeenIt == SeenFragments.end()) {
2236-
SmallSet<FragmentInfo, 4> OneFragment;
2237-
OneFragment.insert(ThisFragment);
2238-
SeenFragments.insert({MIVar.getVariable(), OneFragment});
2234+
auto [SeenIt, Inserted] = SeenFragments.try_emplace(MIVar.getVariable());
2235+
if (Inserted) {
2236+
SeenIt->second.insert(ThisFragment);
22392237

22402238
OverlapFragments.insert({{MIVar.getVariable(), ThisFragment}, {}});
22412239
return;

0 commit comments

Comments
 (0)