[PATCH] D114578: [DebugInfo][InstrRef] Permit and track variable assignments in out-of-scope blocks
Jeremy Morse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 25 03:55:54 PST 2021
jmorse created this revision.
jmorse added reviewers: TWeaver, Orlando, StephenTozer, djtodoro.
Herald added subscribers: pengfei, hiraditya.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Allow and track variable assignments that happen in blocks that are out-of-scope. This happens when a DBG_INSTR_REF or DBG_VALUE gets moved to a block where no instructions are in its lexical scope, or the instructions in-scope are moved / merged so that the block is no longer in scope.
What to do in the general case is arguable -- LiveDebugValues already loses some variable locations due to its scope trimming, see PR48091 -- but the scope trimming is necessary for performance reasons. There's already a test though, llvm/test/DebugInfo/X86/stack-value-dwarf2.ll , that depends on assignments in out-of-scope blocks being preserved, so lets preserved VarLoc LiveDebugValues' behaviour for now. I ran it through the compile-time-tracker [0] and its performance effects are fractional.
[0] http://llvm-compile-time-tracker.com/compare.php?from=83be083d8567316ff2dd6e9651009cc2d615a69a&to=fbcd0356ed20c959cba82b1d710d97ef40b7e547&stat=instructions
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D114578
Files:
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
llvm/test/DebugInfo/X86/stack-value-dwarf2.ll
Index: llvm/test/DebugInfo/X86/stack-value-dwarf2.ll
===================================================================
--- llvm/test/DebugInfo/X86/stack-value-dwarf2.ll
+++ llvm/test/DebugInfo/X86/stack-value-dwarf2.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj -o - %s -experimental-debug-variable-locations=false | llvm-dwarfdump -debug-loc - | FileCheck %s
+; RUN: llc -filetype=obj -o - %s -experimental-debug-variable-locations=true | llvm-dwarfdump -debug-loc - | FileCheck %s
; Note that it would be even better to avoid emitting the empty piece.
; CHECK: {{.*}}: DW_OP_piece 0x8{{$}}
Index: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
===================================================================
--- llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -2487,11 +2487,10 @@
// "blocks that are potentially in scope. See comment at start of vlocJoin.
SmallPtrSet<const MachineBasicBlock *, 8> InScopeBlocks = BlocksToExplore;
- // Old LiveDebugValues tracks variable locations that come out of blocks
- // not in scope, where DBG_VALUEs occur. This is something we could
- // legitimately ignore, but lets allow it for now.
- if (EmulateOldLDV)
- BlocksToExplore.insert(AssignBlocks.begin(), AssignBlocks.end());
+ // VarLoc LiveDebugValues tracks variable locations that are defined in
+ // blocks not in scope. This is something we could legitimately ignore, but
+ // lets allow it for now for the sake of coverage.
+ BlocksToExplore.insert(AssignBlocks.begin(), AssignBlocks.end());
// We also need to propagate variable values through any artificial blocks
// that immediately follow blocks in scope.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114578.389726.patch
Type: text/x-patch
Size: 1727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211125/e192a65a/attachment.bin>
More information about the llvm-commits
mailing list