Skip to content

Commit b648576

Browse files
[CodeGen] Avoid repeated hash lookups (NFC) (llvm#131495)
1 parent 4e841d7 commit b648576

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

llvm/lib/CodeGen/MachineDebugify.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,14 @@ bool applyDebugifyMetadataToMachineFunction(MachineModuleInfo &MMI,
123123

124124
// Find a suitable local variable for the DBG_VALUE.
125125
unsigned Line = MI.getDebugLoc().getLine();
126-
if (!Line2Var.count(Line))
126+
auto It = Line2Var.find(Line);
127+
if (It == Line2Var.end()) {
127128
Line = EarliestDVI ? EarliestDVI->getDebugLoc().getLine()
128129
: EarliestDVR->getDebugLoc().getLine();
129-
DILocalVariable *LocalVar = Line2Var[Line];
130+
It = Line2Var.find(Line);
131+
assert(It != Line2Var.end());
132+
}
133+
DILocalVariable *LocalVar = It->second;
130134
assert(LocalVar && "No variable for current line?");
131135
VarSet.insert(LocalVar);
132136

0 commit comments

Comments
 (0)