Skip to content

Commit c531255

Browse files
[CodeGen] Avoid repeated hash lookups (NFC) (#123287)
1 parent d5aa6df commit c531255

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,10 @@ void FunctionVarLocs::init(FunctionVarLocsBuilder &Builder) {
230230
for (const DbgVariableRecord &DVR : filterDbgVars(I->getDbgRecordRange())) {
231231
// Even though DVR defines a variable location, VarLocsBeforeInst can
232232
// still be empty if that VarLoc was redundant.
233-
if (!Builder.VarLocsBeforeInst.count(&DVR))
233+
auto It = Builder.VarLocsBeforeInst.find(&DVR);
234+
if (It == Builder.VarLocsBeforeInst.end())
234235
continue;
235-
for (const VarLocInfo &VarLoc : Builder.VarLocsBeforeInst[&DVR])
236+
for (const VarLocInfo &VarLoc : It->second)
236237
VarLocRecords.emplace_back(VarLoc);
237238
}
238239
for (const VarLocInfo &VarLoc : P.second)

0 commit comments

Comments
 (0)