[PATCH] D71416: [LiveDebugValues] Omit entry values for DBG_VALUEs with pre-existing expressions

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 05:57:34 PST 2019


dstenb created this revision.
dstenb added reviewers: djtodoro, aprantl, jmorse, vsk.
dstenb added a project: debug-info.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

This is a quickfix for PR44275. An assertion that checks that the
DIExpression is valid failed due to attempting to create an entry value
for an indirect parameter. This started appearing after D69028 <https://reviews.llvm.org/D69028>, as the
indirect parameter started being represented using an DW_OP_deref,
rather than with the DBG_VALUE's second operand, meaning that the
isIndirectDebugValue() check in LiveDebugValues did not exclude such
parameters. A DIExpression that has an entry value operation can
currently not have any other operation, leading to the failed isValid()
check.

This patch simply makes us stop considering emitting entry values
for such parameters. To support such cases I think we at least need
to do the following changes:

- In DIExpression::isValid(): Remove the limitation that a DW_OP_LLVM_entry_value operation can be the only operation in a DIExpression.
- In LiveDebugValues::emitEntryValues(): Create an entry value of size 1, so that it only wraps the register operand, and not the whole pre-existing expression (the DW_OP_deref).
- In LiveDebugValues::removeEntryValue(): Check that the new debug value has the same debug expression as the original, rather than checking that the debug expression is empty.
- In DwarfExpression::addMachineRegExpression(): Modify the logic so that a DW_OP_reg* expression is emitted for the entry value. That is how GCC emits entry values for indirect parameters. That will currently not happen to due the DW_OP_deref causing the !HasComplexExpression to fail. The LocationKind needs to be changed also, rather than always emitting a DW_OP_stack_value for entry values.

There are probably more things I have missed, but that could hopefully
be a good starting point for emitting such entry values.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71416

Files:
  llvm/lib/CodeGen/LiveDebugValues.cpp
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71416.233598.patch
Type: text/x-patch
Size: 7889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191212/51b58f4e/attachment.bin>


More information about the llvm-commits mailing list