[PATCH] D56151: [DebugInfo] PR40010: Avoid register coalesing altering DBG_VALUE valuations

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 4 03:30:55 PST 2019


jmorse updated this revision to Diff 180216.
jmorse added a comment.

Here's a further revision. Two significant changes:

- Because DBG_VALUEs of either the source or destination register can be resurrected by coalescing, check both,
- There's now no attempt to check whether the two registers refer to the same value number.

Examining physical registers is only performed for the destination regnum as the CoalescerPair class cannonicalises to make any physreg the destination.

LiveIntervals isn't as strong an analysis as I'd thought, and it looks like my attempt in the previous revision to find the value the DBG_VALUE referred to before it was killed, will break in the presence of any control flow. The patch as it is will now make DBG_VALUEs undef even if the coalescing by coincidence resurrects it to the same value. IMHO this is a reasonable trade-off when we can't prove the resurrection is correct.

On a stage2 build of llvm/clang r349779 a trivial fraction of variable locations are lost by this (less than 0.01%).

It'd be great to revert this patch if we reach a state where dead DBG_VALUEs can't make it as far as simple-register-coalescing in the future.


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

https://reviews.llvm.org/D56151

Files:
  lib/CodeGen/RegisterCoalescer.cpp
  test/CodeGen/X86/pr40010.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56151.180216.patch
Type: text/x-patch
Size: 15293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190104/63b62878/attachment.bin>


More information about the llvm-commits mailing list