[llvm] c290a8b - [DebugInfo] Fix: Variables that have no non-empty values being emitted when they have a DBG_VALUE_LIST
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 25 13:28:37 PST 2022
Author: Stephen Tozer
Date: 2022-12-25T13:28:27-08:00
New Revision: c290a8b7a4aa0fefd2c9f3f13a1bb507d8608d7d
URL: https://github.com/llvm/llvm-project/commit/c290a8b7a4aa0fefd2c9f3f13a1bb507d8608d7d
DIFF: https://github.com/llvm/llvm-project/commit/c290a8b7a4aa0fefd2c9f3f13a1bb507d8608d7d.diff
LOG: [DebugInfo] Fix: Variables that have no non-empty values being emitted when they have a DBG_VALUE_LIST
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.
Reviewed By: Orlando
Differential Revision: https://reviews.llvm.org/D133925
Added:
Modified:
llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
llvm/test/DebugInfo/X86/dbg_value_list_emission.mir
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp b/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
index 42715efbee09d..2c90b9c150098 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
@@ -264,7 +264,7 @@ bool DbgValueHistoryMap::hasNonEmptyLocation(const Entries &Entries) const {
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;
diff --git a/llvm/test/DebugInfo/X86/dbg_value_list_emission.mir b/llvm/test/DebugInfo/X86/dbg_value_list_emission.mir
index e447fa82f95b3..b96582473cd0b 100644
--- a/llvm/test/DebugInfo/X86/dbg_value_list_emission.mir
+++ b/llvm/test/DebugInfo/X86/dbg_value_list_emission.mir
@@ -93,9 +93,7 @@ body: |
; (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
...
More information about the llvm-commits
mailing list