[llvm] 102d2a8 - [DebugInfo][InstrRef] Track variable assignments in out-of-scope blocks

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 25 06:52:20 PST 2021


Author: Jeremy Morse
Date: 2021-11-25T14:52:11Z
New Revision: 102d2a8a99057b2f54ca97661f862e33d055171a

URL: https://github.com/llvm/llvm-project/commit/102d2a8a99057b2f54ca97661f862e33d055171a
DIFF: https://github.com/llvm/llvm-project/commit/102d2a8a99057b2f54ca97661f862e33d055171a.diff

LOG: [DebugInfo][InstrRef] Track variable assignments in out-of-scope blocks

DBG_INSTR_REF's and  DBG_VALUE's can end up in blocks that aren't in the
lexical scope of their variable. It's arguable as to what we should do
about this, however VarLocBasedLDV permits such variable locations to be
propagated, so let's allow it in InstrRefBasedLDV.

It's necessary for the modified test to work.

Differential Revision: https://reviews.llvm.org/D114578

Added: 
    

Modified: 
    llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
    llvm/test/DebugInfo/X86/stack-value-dwarf2.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 6d19c23d6358a..eff8ec7900383 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -2487,11 +2487,10 @@ void InstrRefBasedLDV::buildVLocValueMap(const DILocation *DILoc,
   // "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.

diff  --git a/llvm/test/DebugInfo/X86/stack-value-dwarf2.ll b/llvm/test/DebugInfo/X86/stack-value-dwarf2.ll
index 0db70b990624a..094dd94547507 100644
--- a/llvm/test/DebugInfo/X86/stack-value-dwarf2.ll
+++ b/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{{$}}


        


More information about the llvm-commits mailing list