[PATCH] D71279: [DebugInfo][MachineSink] Don't stop copy-propagating DBG_VALUEs that will have a sunk copy created

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 08:53:19 PST 2019


jmorse created this revision.
jmorse added reviewers: aprantl, vsk, bjope, uabelho.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

When sinking instructions, and sinking DBG_VALUEs at the same time, we leave one DBG_VALUE at the source location to either mark an undef location, or copy-propagate it if it can be recovered. However, this remaining DBG_VALUE wasn't receiving any further copy propagation (there can be multiple copies in a row), potentially leading to a debug use-before-def. Fix this by trying to copy-propagate all DBG_VALUEs, including those that used to refer to a sunk instruction,

While we're at it, "PerformTrivialForwardCoalescing" occasionally eliminates COPYs, leading to dropped variable locations in one of the added tests. Fix this by updating our list of debug-users-of-vregs whenever we coalesce a register this way.

There are zero changes to the location statistics for a clang-3.4 build with this patch (alas), it's purely a correctness thing.

You may notice that MachineSink.cpp seems to be accumulating a lot of debug related stuff... this is partially because it's had my attention through its use of collectDebugValues, but I would also describe shuffling DBG_VALUEs around as "fiddly". I'll see at some point whether this can be generalised in some way.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71279

Files:
  llvm/lib/CodeGen/MachineSink.cpp
  llvm/test/DebugInfo/MIR/X86/machinesink.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71279.233112.patch
Type: text/x-patch
Size: 8267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191210/1c3e69dd/attachment.bin>


More information about the llvm-commits mailing list