diff --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp --- a/llvm/lib/CodeGen/StackColoring.cpp +++ b/llvm/lib/CodeGen/StackColoring.cpp @@ -712,7 +712,7 @@ } Markers.push_back(&MI); MarkersFound += 1; - } else { + } else if (!MI.isDebugInstr()) { for (const MachineOperand &MO : MI.operands()) { if (!MO.isFI()) continue; diff --git a/llvm/test/CodeGen/X86/StackColoring-dbg-invariance.mir b/llvm/test/CodeGen/X86/StackColoring-dbg-invariance.mir --- a/llvm/test/CodeGen/X86/StackColoring-dbg-invariance.mir +++ b/llvm/test/CodeGen/X86/StackColoring-dbg-invariance.mir @@ -74,9 +74,9 @@ ; CHECK-LABEL: name: test_1 ; CHECK: liveins: $edi - ; CHECK: DBG_VALUE %stack.1.a4, $noreg, !9, !DIExpression(), debug-location !11 + ; CHECK: DBG_VALUE %stack.0.a1, $noreg, !9, !DIExpression(), debug-location !11 ; CHECK: [[LEA64r:%[0-9]+]]:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg - ; CHECK: [[LEA64r1:%[0-9]+]]:gr64 = LEA64r %stack.1.a4, 1, $noreg, 0, $noreg + ; CHECK: [[LEA64r1:%[0-9]+]]:gr64 = LEA64r %stack.0.a1, 1, $noreg, 0, $noreg ; CHECK: RET 0 DBG_VALUE %stack.3.a4, $noreg, !9, !DIExpression(), debug-location !11 LIFETIME_START %stack.3.a4