[PATCH] D87233: [POC][DebugInfo] Use entry values within IR

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 07:16:24 PDT 2020


StephenTozer added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp:290-292
+  // FIXME: Simplify the statements regarding entry values.
+  if (!isMemoryLocation() && (!HasComplexExpression || isEntryValue()) &&
       (!isParameterValue() || isEntryValue())) {
----------------
Should be fixed up before merging (relatively simple logic reassociation).


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:1630
+  LLVM_DEBUG(llvm::dbgs() << "Express the entry value in terms of DWARF: ";
+             Op0->dump(););
+
----------------
Nit: I //believe// you don't need to end the final statement in LLVM_DEBUG with a semicolon.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:1632-1633
+
+  // Try to express the entry value in terms of DWARF.
+  // FIXME: This is from salvageDebugInfoImpl(). Factor this out into a func.
+  auto applyOffset = [&](uint64_t Offset) -> DIExpression * {
----------------
Would it not be possible to just use salvageDebugInfoImpl directly here? As far as I understand, there's no reason we shouldn't be able to support all of the salvage options for an entry value. Also, it should be possible to perform this salvage repeatedly; i.e. if we have:
```
void foo(int param) {
  int i = param + 3;
  int j = i + 6;
}
```
When creating an entry value for `j`, we could attempt to salvage it, find that the first operand `%i` is not an argument but can itself be salvaged, then attempt to salvage `%i` and find that its first operand is an argument, resulting in an entry value `%param, DIExpression(DW_OP_plus_uconst, 3, DW_OP_plus_uconst, 6)`.


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

https://reviews.llvm.org/D87233



More information about the llvm-commits mailing list