diff --git a/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp index a5e6bebcd29c7..6306476fac657 100644 --- a/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp +++ b/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp @@ -997,13 +997,6 @@ class VarLocBasedLDV : public LDVImpl { return *VLS; } - const VarLocSet &getVarLocsInMBB(const MachineBasicBlock *MBB, - const VarLocInMBB &Locs) const { - auto It = Locs.find(MBB); - assert(It != Locs.end() && "MBB not in map"); - return *It->second; - } - /// Tests whether this instruction is a spill to a stack location. bool isSpillInstruction(const MachineInstr &MI, MachineFunction *MF); @@ -1286,7 +1279,10 @@ void VarLocBasedLDV::printVarLocInMBB(const MachineFunction &MF, for (const MachineBasicBlock &BB : MF) { if (!V.count(&BB)) continue; - const VarLocSet &L = getVarLocsInMBB(&BB, V); + auto It = V.find(&BB); + if (It == V.end()) + continue; + const VarLocSet &L = *It->second; if (L.empty()) continue; SmallVector VarLocs;