[PATCH] D109142: LiveDebugValues pass incorrectly handles register spill for indirect debug values

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 8 04:08:03 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG93b09a2a5d78: [LiveDebugValues] Handle spills of indirect debug values correctly (authored by evgeny777).

Changed prior to commit:
  https://reviews.llvm.org/D109142?vs=370204&id=371311#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109142/new/

https://reviews.llvm.org/D109142

Files:
  llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
  llvm/test/DebugInfo/MIR/X86/live-debug-values-restore.mir


Index: llvm/test/DebugInfo/MIR/X86/live-debug-values-restore.mir
===================================================================
--- llvm/test/DebugInfo/MIR/X86/live-debug-values-restore.mir
+++ llvm/test/DebugInfo/MIR/X86/live-debug-values-restore.mir
@@ -641,7 +641,7 @@
 # CHECK-LABEL: bb.0.entry:
 # CHECK:       DBG_VALUE $rdi, 0, ![[TVAR]], !DIExpression()
 # CHECK-LABEL: bb.1.if.then:
-# CHECK:       DBG_VALUE $rsp, 0, ![[TVAR]], !DIExpression(DW_OP_constu, 8, DW_OP_minus)
+# CHECK:       DBG_VALUE $rsp, 0, ![[TVAR]], !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref)
 # CHECK:       INLINEASM
 # CHECK:       DBG_VALUE ${{[a-zA-Z0-9]+}}, 0, ![[TVAR]], !DIExpression()
 # CHECK-LABEL: bb.2.if.end
Index: llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
===================================================================
--- llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
+++ llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
@@ -556,9 +556,10 @@
           unsigned Base = Loc.SpillLocation.SpillBase;
           auto *TRI = MF.getSubtarget().getRegisterInfo();
           if (MI.isNonListDebugValue()) {
-            DIExpr =
-                TRI->prependOffsetExpression(DIExpr, DIExpression::ApplyOffset,
-                                             Loc.SpillLocation.SpillOffset);
+            auto Deref = Indirect ? DIExpression::DerefAfter : 0;
+            DIExpr = TRI->prependOffsetExpression(
+                DIExpr, DIExpression::ApplyOffset | Deref,
+                Loc.SpillLocation.SpillOffset);
             Indirect = true;
           } else {
             SmallVector<uint64_t, 4> Ops;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109142.371311.patch
Type: text/x-patch
Size: 1643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210908/3dfd5c03/attachment-0001.bin>


More information about the llvm-commits mailing list