[PATCH] D108641: [DebugInfo][InstrRef] Avoid a debug-info-affects-codegen scenario in MCP

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 24 10:07:13 PDT 2021


jmorse created this revision.
jmorse added reviewers: Orlando, StephenTozer, TWeaver, djtodoro.
Herald added subscribers: hiraditya, kristof.beyls.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The machine-copy-propagation pass collects all debug uses of instructions and then tries to propagate copies through them -- this includes DBG_PHIs, which can refer to COPYs in rare circumstances where tail duplication simplifies control flow. Such DBG_PHIs should also have copies propagated through them: update the helper utility to do so. I've added a DBG_PHI to an ARM test that tests this behaviour, i.e. that copies get propagated in debug instructions.

In addition, this patch also correctly sets the "debug-use" flag on DBG_PHIs when they're read from MIR files, which was previously being omitted. This is covered by the test, as copy propagation won't happen if there's a non-debug-use of the $r4.

Finally, call setIsDebug when DBG_PHIs are created in LiveDebugVariables. I, uh, don't know of a way to test for this, because "debug-use" doesn't seem to be printed by the MIR printer. Ouch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108641

Files:
  llvm/include/llvm/CodeGen/MachineRegisterInfo.h
  llvm/lib/CodeGen/LiveDebugVariables.cpp
  llvm/lib/CodeGen/MIRParser/MIParser.cpp
  llvm/test/DebugInfo/ARM/machine-cp-updates-dbg-reg.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108641.368381.patch
Type: text/x-patch
Size: 4948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210824/35327718/attachment.bin>


More information about the llvm-commits mailing list