[PATCH] D69028: [DebugInfo] Correctly place DW_OP_derefs for arguments passed on stack

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 05:30:10 PDT 2019


uabelho added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:5558
+  if (!Op->isReg())
+    Expr = DIExpression::prepend(Expr, DIExpression::DerefBefore);
+
----------------
Nice, I think this is heading the right direction!
However, if we look at  PEI::replaceFrameIndices which handles the indirect stuff, it uses DW_OP_deref_size rather than DW_OP_deref:

```
        if (MI.isIndirectDebugValue() && DIExpr->isImplicit()) {
          SmallVector<uint64_t, 2> Ops = {dwarf::DW_OP_deref_size, Size};
          bool WithStackValue = true;
          DIExpr = DIExpression::prependOpcodes(DIExpr, Ops, WithStackValue);
          // Make the DBG_VALUE direct.
          MI.getOperand(1).ChangeToRegister(0, false);
        }
```
I think we need to take the size into consideration here in SelectionDAGBuilder too.

My out-of-tree big-endian target example now goes wrong since we read a value that is placed adjacent to the wanted value on the stack. I think using DW_OP_deref_size could perhaps solve that.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D69028





More information about the llvm-commits mailing list