[PATCH] D133925: [DebugInfo] Fix: Variables that have no non-empty values being emitted when they have a DBG_VALUE_LIST
Stephen Tozer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 15 02:40:14 PDT 2022
StephenTozer created this revision.
StephenTozer added reviewers: jmorse, Orlando.
StephenTozer added a project: debug-info.
Herald added a subscriber: hiraditya.
Herald added a project: All.
StephenTozer requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch fixes a simple bug where `DbgValueHistoryMap::hasNonEmptyLocation` was incorrectly handling DBG_VALUE_LIST instructions, treating empty values as non-empty, causing empty variables to be emitted into DWARF.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D133925
Files:
llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
llvm/test/DebugInfo/X86/dbg_value_list_emission.mir
Index: llvm/test/DebugInfo/X86/dbg_value_list_emission.mir
===================================================================
--- llvm/test/DebugInfo/X86/dbg_value_list_emission.mir
+++ llvm/test/DebugInfo/X86/dbg_value_list_emission.mir
@@ -93,9 +93,7 @@
; (8) Check that a single $noreg location invalidates the entire entry.
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
- ; CHECK: DW_TAG_variable
- ; CHECK-NEXT: DW_AT_name ("localh")
- ; CHECK-NOT: DW_AT_location
+ ; CHECK-NOT: DW_AT_name ("localh")
RET64 debug-location !15
...
Index: llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
@@ -264,7 +264,7 @@
const MachineInstr *MI = Entry.getInstr();
assert(MI->isDebugValue());
// A DBG_VALUE $noreg is an empty variable location
- if (MI->getOperand(0).isReg() && MI->getOperand(0).getReg() == 0)
+ if (MI->isUndefDebugValue())
continue;
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133925.460336.patch
Type: text/x-patch
Size: 1244 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220915/802f39cd/attachment.bin>
More information about the llvm-commits
mailing list