[PATCH] D56265: [DebugInfo] MCP: collect and update DBG_VALUEs encountered in local block

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 3 04:35:59 PST 2019


jmorse created this revision.
jmorse added reviewers: vsk, aprantl, CarlosAlbertoEnciso, dstenb.
Herald added a subscriber: llvm-commits.

The purpose of this patch is to remove a user of collectDebugValues (via changeDebugValuesDefReg): it currently assumes that all DBG_VALUEs immediately follow the specified instruction, which isn't necessarily true. This is going to become very often untrue when PR38754 work is merged. It also cannot be fixed by collectDebugValues iterating over register users because MCP runs after regalloc.

Instead of calling changeDebugValuesDefReg on an instruction to change its debug users, in this patch we instead collect DBG_VALUEs of copies as we iterate over insns, and update the debug users of copies that are made dead. This isn't a non-functional change, because MCP will now update DBG_VALUEs that aren't immediately after a copy, but refer to the same register. I've hijacked the regression test for PR38773 to test for this new behaviour, an entirely new test seemed overkill.

While fiddling with this patch an obvious question came to me, of "Why don't we copy-propagate the debug users just like other instructions?". The reason why is that DBG_VALUEs are re-generated after regalloc, and don't get the 'renameable' flag assigned to their register operands, preventing them from being renamed here. (Plus, debug users have no register class). Addressing that seemed like quite a large modification for a small issue.


Repository:
  rL LLVM

https://reviews.llvm.org/D56265

Files:
  lib/CodeGen/MachineCopyPropagation.cpp
  test/CodeGen/MIR/X86/pr38773.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56265.180037.patch
Type: text/x-patch
Size: 3889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190103/2ee6705b/attachment.bin>


More information about the llvm-commits mailing list