Skip to content

Commit def915c

Browse files
committed
[DebugInfo] Variables with only empty values emitting when one is variadic
This patch fixes a simple bug in DbgValueHistoryMap::hasNonEmptyLocation that caused it to treat empty DBG_VALUE_LIST instructions as non-empty when determining whether to emit a variable or not. Differential Revision: https://reviews.llvm.org/D133925
1 parent 9aa5de9 commit def915c

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ bool DbgValueHistoryMap::hasNonEmptyLocation(const Entries &Entries) const {
264264
const MachineInstr *MI = Entry.getInstr();
265265
assert(MI->isDebugValue());
266266
// A DBG_VALUE $noreg is an empty variable location
267-
if (MI->getOperand(0).isReg() && MI->getOperand(0).getReg() == 0)
267+
if (MI->isUndefDebugValue())
268268
continue;
269269

270270
return true;

llvm/test/DebugInfo/X86/dbg_value_list_emission.mir

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ body: |
9393
9494
; (8) Check that a single $noreg location invalidates the entire entry.
9595
DBG_VALUE_LIST !30, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $eax, $noreg, debug-location !15
96-
; CHECK: DW_TAG_variable
97-
; CHECK-NEXT: DW_AT_name ("localh")
98-
; CHECK-NOT: DW_AT_location
96+
; CHECK-NOT: DW_AT_name ("localh")
9997
10098
RET64 debug-location !15
10199
...

0 commit comments

Comments
 (0)