[PATCH] D61940: [WIP][DebugInfo] Don't always extend variable locations when the reg location is unchanging

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 05:10:40 PDT 2019


jmorse created this revision.
Herald added subscribers: llvm-commits, kristof.beyls, eraman, javed.absar, aprantl.
Herald added a project: LLVM.

[Not for review right now]

While investigating how to fix a patch that was reverted (r359426 in r360301), I took a shot at removing the "ChangingRegs" facility in DbgEntityHistoryCalculator, as its overapproximate nature can produce incorrect variable locations (see [0]). The original intention (D3933 <https://reviews.llvm.org/D3933>) seems to have been to increase the number of scenarios where single-location variable records are used in the DWARF output.

This patch (which depends on D61600 <https://reviews.llvm.org/D61600>) currently deletes everything to do with detecting when a register doesn't change. The test changes demonstrate the differences in output. Two of interest:

- struct_by_value.ll doesn't get a single-location variable record any more because the code in the function clobbers that single location (my understanding of aarch64 is w0 aliases x0): 0:	00 00 40 b9 	ldr	w0, [x0] 4:	c0 03 5f d6 	ret
- inlined-argument.ll: Everything in this code except the final "ret" is from an inlined function, and is in multiple blocks. My understanding is that the single-location detection algorithm [1] doesn't actually support detecting this scenario: we just get it right because ChangingRegs causes the locations to spill over into the return block, covering the whole function.

The other 4 tests all have minor differences because we now observe epilogue instructions as clobbering locations. We can now use the "frame-destroy" MIR flag to filter those clobbers out, it apparently wasn't available in the time of D3933 <https://reviews.llvm.org/D3933>.

I'm currently working on detecting the frame-destroy flag to reduce the number of test changes; I've uploaded this WIP patch now to demonstrate in the related patches (D61600 <https://reviews.llvm.org/D61600>, D61890 <https://reviews.llvm.org/D61890>) that killing off ChangingRegs should be a feasible direction.

[0] https://reviews.llvm.org/D61600#1493393
[1] https://github.com/llvm/llvm-project/blob/c93f56d39e629b7bcd0f4657705264fcd7e47c0d/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp#L1242


Repository:
  rL LLVM

https://reviews.llvm.org/D61940

Files:
  lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
  test/DebugInfo/AArch64/inlined-argument.ll
  test/DebugInfo/AArch64/struct_by_value.ll
  test/DebugInfo/X86/debug-loc-offset.mir
  test/DebugInfo/X86/pr19307.mir
  test/DebugInfo/X86/reference-argument.ll
  test/DebugInfo/X86/stack-value-piece.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61940.199577.patch
Type: text/x-patch
Size: 9672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190515/768e60c6/attachment.bin>


More information about the llvm-commits mailing list