[PATCH] D114364: [DebugInfo][5/N] Recognise extra indirection in instruction-referencing for NRVO tests

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 25 13:44:38 PST 2021


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG536b9eb31e93: [DebugInfo][InstrRef] Add extra indirection for NRVO tests (authored by jmorse).

Changed prior to commit:
  https://reviews.llvm.org/D114364?vs=388888&id=389881#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114364

Files:
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
  llvm/test/DebugInfo/X86/spill-indirect-nrvo.ll
  llvm/test/DebugInfo/X86/spill-nontrivial-param.ll


Index: llvm/test/DebugInfo/X86/spill-nontrivial-param.ll
===================================================================
--- llvm/test/DebugInfo/X86/spill-nontrivial-param.ll
+++ llvm/test/DebugInfo/X86/spill-nontrivial-param.ll
@@ -1,4 +1,5 @@
 ; RUN: llc < %s -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc < %s -experimental-debug-variable-locations=true | FileCheck %s
 
 ; Make sure we insert DW_OP_deref when spilling indirect DBG_VALUE instructions.
 ; In this example, 'nt' is passed by address because it is not trivially
Index: llvm/test/DebugInfo/X86/spill-indirect-nrvo.ll
===================================================================
--- llvm/test/DebugInfo/X86/spill-indirect-nrvo.ll
+++ llvm/test/DebugInfo/X86/spill-indirect-nrvo.ll
@@ -1,5 +1,7 @@
 ; RUN: llc < %s -experimental-debug-variable-locations=false | FileCheck -check-prefixes=CHECK,OPT %s
 ; RUN: llc -O0 < %s -experimental-debug-variable-locations=false | FileCheck -check-prefixes=CHECK,OPTNONE %s
+; RUN: llc < %s -experimental-debug-variable-locations=true | FileCheck -check-prefixes=CHECK,OPT %s
+; RUN: llc -O0 < %s -experimental-debug-variable-locations=true | FileCheck -check-prefixes=CHECK,OPTNONE %s
 
 ; Make sure we insert DW_OP_deref when spilling indirect DBG_VALUE instructions.
 
Index: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
===================================================================
--- llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -836,6 +836,15 @@
       unsigned Base = Spill.SpillBase;
       MIB.addReg(Base);
       MIB.addImm(0);
+
+      // Being on the stack makes this location indirect; if it was _already_
+      // indirect though, we need to add extra indirection. See this test for
+      // a scenario where this happens:
+      //     llvm/test/DebugInfo/X86/spill-nontrivial-param.ll
+      if (Properties.Indirect) {
+        std::vector<uint64_t> Elts = {dwarf::DW_OP_deref};
+        Expr = DIExpression::append(Expr, Elts);
+      }
     } else {
       // This is a stack location with a weird subregister offset: emit an undef
       // DBG_VALUE instead.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114364.389881.patch
Type: text/x-patch
Size: 2211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211125/357846e7/attachment.bin>


More information about the llvm-commits mailing list