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

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 29 10:12:48 PST 2018


jmorse created this revision.
jmorse added reviewers: aprantl, vsk, kparzysz, bjope.
Herald added subscribers: llvm-commits, tpr, qcolombet, MatzeB.

This is a fix for PR40010 [0]. DBG_VALUE instructions do not contribute to the liveness of virtual registers, making them invisible to the register coaleser, which may merge new register valuations over the top of DBG_VALUEs. When this happens, new valuations can appear to debuggers that were never in the source program, which is misleading.

To avoid this, examine the debug users of the register being eliminated, and pick out any that:

1. Lie in a location where the register isn't live, and
2. Where the destination register has a def in between the DBG_VALUE and the def it refers to

This can leave DBG_VALUEs of non-live registers so long as the register isn't written to.

Note this also marks use-before-any-def's as undef, if they're coalesced to a different register, as it's unclear to me how to establish which def a DBG_VALUE is supposed to refer to in that case.

[0] https://bugs.llvm.org/show_bug.cgi?id=40010


Repository:
  rL LLVM

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.179701.patch
Type: text/x-patch
Size: 13328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181229/45450a0c/attachment.bin>


More information about the llvm-commits mailing list