[PATCH] D156545: [DebugInfo][InstrRef] Don't produce over-sized DW_OP_deref_size expressions for very wide stack spills

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 07:59:11 PDT 2023


jmorse created this revision.
jmorse added reviewers: StephenTozer, Orlando, probinson, dblaikie.
Herald added subscribers: pengfei, hiraditya.
Herald added a project: All.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Addresses https://github.com/llvm/llvm-project/issues/64093 , where instruction referencing is producing an over-sized DW_OP_deref_size expression.

When we describe the locations of variables that have been spilt to the stack, there are occasions where we need to use DW_OP_deref_size, to indicate "this 32 bit variable is the lower order bits of the 64 bit value at this location". This has a meaningful difference on big endian systems, because the consumer can't necessarily know that the smaller value it's looking for is at a different position in a large spill slot.

It's not completely clear to me that instruction referencing is doing this correctly; it also probably isn't useful on a little endian system like x86. Fix the most obvious problem first: the DWARF spec says that the size of DW_OP_deref_size must not exceed the natural address size of the machine, so don't try to produce a DW_OP_deref_size if the operand would be bigger than the pointer size. Test comes from the github bug. While we're at it, refactor the logic into a utility function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156545

Files:
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
  llvm/test/DebugInfo/MIR/InstrRef/livedebugvalues_deref_size_too_big.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156545.545167.patch
Type: text/x-patch
Size: 9858 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230728/2932b1ec/attachment.bin>


More information about the llvm-commits mailing list