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

Pavel Kosov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 2 02:27:44 PDT 2021


kpdev42 created this revision.
kpdev42 added reviewers: aprantl, keith.walker.arm, vsk, dstenb.
kpdev42 added a project: LLVM.
Herald added a subscriber: hiraditya.
kpdev42 requested review of this revision.

Fixes PR: https://bugs.llvm.org/show_bug.cgi?id=51704


Repository:
  rG LLVM Github Monorepo

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
@@ -553,8 +553,9 @@
           unsigned Base = Loc.SpillLocation.SpillBase;
           auto *TRI = MF.getSubtarget().getRegisterInfo();
           if (MI.isNonListDebugValue()) {
+            auto Deref = Indirect ? DIExpression::DerefAfter : 0;
             DIExpr =
-                TRI->prependOffsetExpression(DIExpr, DIExpression::ApplyOffset,
+                TRI->prependOffsetExpression(DIExpr, DIExpression::ApplyOffset | Deref,
                                              Loc.SpillLocation.SpillOffset);
             Indirect = true;
           } else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109142.370204.patch
Type: text/x-patch
Size: 1527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210902/a073ec14/attachment.bin>


More information about the llvm-commits mailing list