[PATCH] D87357: [SelectionDAG][DebugInfo] Use entry-values to recover parameters values

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 02:21:00 PDT 2020


StephenTozer added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp:718
+    // a DW_OP_entry_value.
+    if (cast<DILocalVariable>(Var)->isParameter())
+      EntryValue =
----------------
djtodoro wrote:
> Orlando wrote:
> > I think this we should only be doing this for immutable parameters (and mutable parameters which are never assigned to), right?
> > 
> > I.e. the entry_value of a parameter register is only a valid location for a parameter variable if that variable is never assigned another value.
> We are expressing the modification in terms of its entry value here.
As far as I understand, we want to recover variables by describing them in relation to the initial values of the parameters. In that case, it only makes sense to consider variables whose values can be expressed in relation to that; this may include variables that aren't parameters themselves, and may exclude dbg.values for parameters. For example:

```
void foo(int param) {
  int x = param + 2;
  param = SomeInt();
  ...
}
```

In this example it should be possible to describe `x` in terms of `param`'s initial value, while `param` itself could not be described by an entry value after its assignment within the function. In that case, I believe it would make more sense to look for dbg.values that use a parameter Value, or can be expressed in terms of one, rather than using `DILocalVariable::isParameter`. Does that seem correct, or have I misunderstood the work or the purpose of this block?


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

https://reviews.llvm.org/D87357



More information about the llvm-commits mailing list