]> granicus.if.org Git - llvm/commit
[DebugInfo] Remove invalidated locations during LiveDebugValues
authorJeremy Morse <jeremy.morse.llvm@gmail.com>
Fri, 23 Aug 2019 16:33:42 +0000 (16:33 +0000)
committerJeremy Morse <jeremy.morse.llvm@gmail.com>
Fri, 23 Aug 2019 16:33:42 +0000 (16:33 +0000)
commit81f9699a8923219ba02c43f4eab74af85b393c8c
tree97ff255d110f6488d390f8bc14bfdcbe0698b259
parentcca8d38975cd094ad8c0f79abe29955951950d94
[DebugInfo] Remove invalidated locations during LiveDebugValues

LiveDebugValues gives variable locations to blocks, but it should also take
away. There are various circumstances where a variable location is known
until a loop backedge with a different location is detected. In those
circumstances, where there's no agreement on the variable location, it
should be undef / removed, otherwise we end up picking a location that's
valid on some loop iterations but not others.

However, LiveDebugValues doesn't currently do this, see the new testcase
attached. Without this patch, the location of !3 is assumed to be %bar
through the loop. Once it's added to the In-Locations list, it's never
removed, even though the later dbg.value(0... of !3 makes the location
un-knowable.

This patch checks during block-location-joining to see whether any
previously-present locations have been removed in a predecessor. If they
have, the live-ins have changed, and the block needs reprocessing.
Similarly, in transferTerminator, assign rather than |= the Out-Locations
after processing a block, as we may have deleted some previously valid
locations. This will mean that LiveDebugValues performs more propagation
 -- but that's necessary for it being correct.

Differential Revision: https://reviews.llvm.org/D66599

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369778 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/LiveDebugValues.cpp
test/DebugInfo/COFF/pieces.ll
test/DebugInfo/X86/fission-ranges.ll
test/DebugInfo/X86/live-debug-values-remove-range.ll [new file with mode: 0644]