[PATCH] D106875: [DebugInfo] Attempt to preserve more information during tail duplication

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 27 07:24:57 PDT 2021


StephenTozer created this revision.
StephenTozer added reviewers: aprantl, dblaikie, jmorse, respindola, probinson.
StephenTozer added a project: debug-info.
Herald added subscribers: pengfei, hiraditya.
StephenTozer requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

As part of putting together the fix in D106557 <https://reviews.llvm.org/D106557>, I noticed that tail duplication looked to be handling debug info poorly - specifically, debug instructions would be dropped instead of being set undef, potentially extending the lifetimes of prior debug values that should be killed. Furthermore, the deleted debug instructions were not necessarily dead - it looks as though the deletion was added to prevent codegen from being affected by debug instructions, resulting in an overly aggressive dropping of debug info. This patch modifies this step to instead make the best attempt to recover debug info without making any codegen changes.

A function has been added to `MachineSSAUpdater`, `GetExistingValueInMiddleOfBlock`, which mimics the current `GetValueInMiddleOfBlock` function but with the addition that it will never generate any instructions, only fetch a vreg if one already exists. This is used to find valid VRegs for debug values, or else set them undef.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106875

Files:
  llvm/include/llvm/CodeGen/MachineSSAUpdater.h
  llvm/lib/CodeGen/MachineSSAUpdater.cpp
  llvm/lib/CodeGen/TailDuplicator.cpp
  llvm/test/CodeGen/X86/tail-dup-debugvalue.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106875.362014.patch
Type: text/x-patch
Size: 5929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210727/e6b1cc5c/attachment.bin>


More information about the llvm-commits mailing list