[PATCH] D62314: [DebugInfo] Use FrameDestroy to extend stack locations to the end of a function
Jeremy Morse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 23 07:04:34 PDT 2019
jmorse created this revision.
jmorse added reviewers: bjope, aprantl, probinson, dstenb, vsk.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch depends on D61940 <https://reviews.llvm.org/D61940>, and is a small part split out of it. We use the FrameDestroy flag to detect the end of the stack frame, and extend stack variable locations past that point. This greatly enhances the chance that we can emit a single-value location.
Most of the discussion about this functionality is in the parent patch; the intention of splitting this part out, is so that out-of-tree backends can revert this patch if they have difficulties with FrameDestroy.
Repository:
rL LLVM
https://reviews.llvm.org/D62314
Files:
lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
test/DebugInfo/COFF/pieces.ll
test/DebugInfo/X86/dbg-addr.ll
test/DebugInfo/X86/debug-loc-offset.mir
test/DebugInfo/X86/pr19307.mir
Index: test/DebugInfo/X86/pr19307.mir
===================================================================
--- test/DebugInfo/X86/pr19307.mir
+++ test/DebugInfo/X86/pr19307.mir
@@ -1,11 +1,5 @@
# RUN: llc -o - %s -start-after=patchable-function -O0 | FileCheck %s
-# XFAIL: *
-# Marked XFail due to the removal of "ChangingRegs" from
-# DbgEntityHistoryCalculator, shortening the checked range to not reach the
-# end of the function. Fixed by an about-to-land patch using the FrameDestroy
-# flag to identify the end of functions.
-
# Generated from the source file pr19307.cc:
# #include <string>
# void parse_range(unsigned long long &offset, unsigned long long &limit,
Index: test/DebugInfo/X86/debug-loc-offset.mir
===================================================================
--- test/DebugInfo/X86/debug-loc-offset.mir
+++ test/DebugInfo/X86/debug-loc-offset.mir
@@ -1,11 +1,5 @@
# RUN: llc -o - %s -start-after=patchable-function -filetype=obj -O0 -mtriple=i386-unknown-linux-gnu -dwarf-version=4 | llvm-dwarfdump -v - | FileCheck %s
-# XFAIL: *
-# Marked XFail due to the removal of "ChangingRegs" from
-# DbgEntityHistoryCalculator, shortening the checked range to not reach the
-# end of the function. Fixed by an about-to-land patch using the FrameDestroy
-# flag to identify the end of functions.
-
# From the code:
#
# debug-loc-offset1.cc
Index: test/DebugInfo/X86/dbg-addr.ll
===================================================================
--- test/DebugInfo/X86/dbg-addr.ll
+++ test/DebugInfo/X86/dbg-addr.ll
@@ -13,8 +13,7 @@
; DW_AT_start_offset instead.
; DWARF: DW_TAG_variable
-; DWARF-NEXT: DW_AT_location (0x00000000
-; DWARF-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_breg7 RSP+0)
+; DWARF-NEXT: DW_AT_location (DW_OP_fbreg +0)
; DWARF-NEXT: DW_AT_name ("o")
Index: test/DebugInfo/COFF/pieces.ll
===================================================================
--- test/DebugInfo/COFF/pieces.ll
+++ test/DebugInfo/COFF/pieces.ll
@@ -104,8 +104,9 @@
; ASM: #APP
; ASM: #NO_APP
; ASM: movl [[offset_o_x]](%rsp), %eax # 4-byte Reload
-; ASM: [[spill_o_x_end:\.Ltmp[0-9]+]]:
; ASM: retq
+; ASM-NEXT: [[spill_o_x_end:\.Ltmp[0-9]+]]:
+; ASM-NEXT: .Lfunc_end4:
; ASM-LABEL: .short 4423 # Record kind: S_GPROC32_ID
@@ -231,7 +232,7 @@
; ASM: .asciz "bitpiece_spill" # Function name
; ASM: .short 4414 # Record kind: S_LOCAL
; ASM: .asciz "o"
-; ASM: .cv_def_range [[spill_o_x_start]] [[spill_o_x_end]], "E\021O\001A\000$\000\000\000"
+; ASM: .cv_def_range [[spill_o_x_start]] .Lfunc_end4, "E\021O\001A\000$\000\000\000"
; OBJ-LABEL: GlobalProcIdSym {
; OBJ: Kind: S_GPROC32_ID (0x1147)
Index: lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
+++ lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
@@ -230,6 +230,7 @@
DbgLabelInstrMap &DbgLabels) {
const TargetLowering *TLI = MF->getSubtarget().getTargetLowering();
unsigned SP = TLI->getStackPointerRegisterToSaveRestore();
+ unsigned FrameReg = TRI->getFrameRegister(*MF);
RegDescribedVarsMap RegVars;
DbgValueEntriesMap LiveEntries;
for (const auto &MBB : *MF) {
@@ -277,7 +278,8 @@
// range. Ignore frame-register defs in the epilogue, we expect
// debuggers to understand that stack-locations are destroyed on
// frame destruction.
- else {
+ else if (MO.getReg() != FrameReg ||
+ !MI.getFlag(MachineInstr::FrameDestroy)) {
for (MCRegAliasIterator AI(MO.getReg(), TRI, true); AI.isValid();
++AI)
clobberRegisterUses(RegVars, *AI, DbgValues, LiveEntries, MI);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62314.200964.patch
Type: text/x-patch
Size: 3981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190523/7d8da03c/attachment.bin>
More information about the llvm-commits
mailing list