Index: include/llvm/CodeGen/MachineBasicBlock.h =================================================================== --- include/llvm/CodeGen/MachineBasicBlock.h +++ include/llvm/CodeGen/MachineBasicBlock.h @@ -693,7 +693,7 @@ bool IsCond); /// Find the next valid DebugLoc starting at MBBI, skipping any DBG_VALUE - /// instructions. Return UnknownLoc if there is none. + /// and DBG_LABEL instructions. Return UnknownLoc if there is none. DebugLoc findDebugLoc(instr_iterator MBBI); DebugLoc findDebugLoc(iterator MBBI) { return findDebugLoc(MBBI.getInstrIterator()); @@ -890,7 +890,7 @@ /// const_instr_iterator} and the respective reverse iterators. template inline IterT skipDebugInstructionsForward(IterT It, IterT End) { - while (It != End && It->isDebugValue()) + while (It != End && (It->isDebugValue() || It->isDebugLabel())) It++; return It; } Index: lib/CodeGen/PatchableFunction.cpp =================================================================== --- lib/CodeGen/PatchableFunction.cpp +++ lib/CodeGen/PatchableFunction.cpp @@ -49,6 +49,7 @@ case TargetOpcode::EH_LABEL: case TargetOpcode::GC_LABEL: case TargetOpcode::DBG_VALUE: + case TargetOpcode::DBG_LABEL: return true; } } Index: lib/CodeGen/TwoAddressInstructionPass.cpp =================================================================== --- lib/CodeGen/TwoAddressInstructionPass.cpp +++ lib/CodeGen/TwoAddressInstructionPass.cpp @@ -291,7 +291,7 @@ unsigned NumVisited = 0; for (MachineInstr &OtherMI : make_range(std::next(OldPos), KillPos)) { // DBG_VALUE cannot be counted against the limit. - if (OtherMI.isDebugValue()) + if (OtherMI.isDebugValue() || OtherMI.isDebugLabel()) continue; if (NumVisited > 30) // FIXME: Arbitrary limit to reduce compile time cost. return false; @@ -941,7 +941,7 @@ ++KillPos; for (MachineInstr &OtherMI : make_range(End, KillPos)) { // DBG_VALUE cannot be counted against the limit. - if (OtherMI.isDebugValue()) + if (OtherMI.isDebugValue() || OtherMI.isDebugLabel()) continue; if (NumVisited > 10) // FIXME: Arbitrary limit to reduce compile time cost. return false; @@ -1115,7 +1115,7 @@ for (MachineInstr &OtherMI : make_range(mi, MachineBasicBlock::iterator(KillMI))) { // DBG_VALUE cannot be counted against the limit. - if (OtherMI.isDebugValue()) + if (OtherMI.isDebugValue() || OtherMI.isDebugLabel()) continue; if (NumVisited > 10) // FIXME: Arbitrary limit to reduce compile time cost. return false;