Skip to content

Commit 05607a3

Browse files
[CodeGen] Avoid repeated hash lookups (NFC) (#131551)
1 parent 2c35cb6 commit 05607a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,13 +2612,13 @@ removeRedundantDbgLocsUsingForwardScan(const BasicBlock *BB,
26122612
NumDefsScanned++;
26132613
DebugVariable Key(FnVarLocs.getVariable(Loc.VariableID).getVariable(),
26142614
std::nullopt, Loc.DL.getInlinedAt());
2615-
auto VMI = VariableMap.find(Key);
2615+
auto [VMI, Inserted] = VariableMap.try_emplace(Key);
26162616

26172617
// Update the map if we found a new value/expression describing the
26182618
// variable, or if the variable wasn't mapped already.
2619-
if (VMI == VariableMap.end() || VMI->second.first != Loc.Values ||
2619+
if (Inserted || VMI->second.first != Loc.Values ||
26202620
VMI->second.second != Loc.Expr) {
2621-
VariableMap[Key] = {Loc.Values, Loc.Expr};
2621+
VMI->second = {Loc.Values, Loc.Expr};
26222622
NewDefs.push_back(Loc);
26232623
continue;
26242624
}

0 commit comments

Comments
 (0)