[PATCH] D128101: [DebugInfo][InstrRef] Fix error in copy handling in InstrRefLDV

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 17 15:00:34 PDT 2022


StephenTozer created this revision.
StephenTozer added reviewers: jmorse, Orlando.
StephenTozer added a project: debug-info.
Herald added subscribers: ormris, hiraditya.
Herald added a project: All.
StephenTozer requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently, an error exists when InstrRefBasedLDV observes transfers of variables across copies, which causes it to lose track of variables under certain circumstances, resulting in shorter lifetimes for those variables as LDV gives up searching for live locations for them.

The issue can be summarised as, when the TransferTracker observes a copy, under certain circumstances it may start tracking variables, that previously were in the source location, in the destination location instead. This is obviously valid, but it then tries to clobber the destination location due to it being overwritten, including clobbering the variables that were just moved to use this location. This does not immediately kill the variable, but causes it to stop being tracked, potentially ending its lifetime early.

This patch fixes this issue by first tracking the specific set of variables and values that already live in the destination, then after updating our underlying store of values (in the MLocTracker) we try to find new locations for all those variables that have been clobbered. Only after that do we potentially move other variables into the destination location, ensuring that no variables are erroneously clobbered and all the existing variables in the destination are given proper homes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128101

Files:
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
  llvm/test/DebugInfo/X86/instr-ref-track-clobbers.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128101.438046.patch
Type: text/x-patch
Size: 9465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220617/37e24fb3/attachment.bin>


More information about the llvm-commits mailing list