]> granicus.if.org Git - llvm/commit
[DebugInfo][InstCombine] Prefer to salvage debuginfo over sinking it
authorJeremy Morse <jeremy.morse.llvm@gmail.com>
Wed, 13 Feb 2019 10:54:53 +0000 (10:54 +0000)
committerJeremy Morse <jeremy.morse.llvm@gmail.com>
Wed, 13 Feb 2019 10:54:53 +0000 (10:54 +0000)
commitb902ab171c3c46f61e4485717b046609956f386b
tree6800b42127ede8eead1527f03f967da87fa6971b
parentf37f383fd3d7ee4243c66ed33344e6ee01e41d5d
[DebugInfo][InstCombine] Prefer to salvage debuginfo over sinking it

When instcombine sinks an instruction between two basic blocks, it sinks any
dbg.value users in the source block with it, to prevent debug use-before-free.
However we can do better by attempting to salvage the debug users, which would
avoid moving where the variable location changes. If we successfully salvage,
still sink a (cloned) dbg.value with the sunk instruction, as the sunk
instruction is more likely to be "live" later in the compilation process.

If we can't salvage dbg.value users of a sunk instruction, mark the dbg.values
in the original block as being undef. This terminates any earlier variable
location range, and represents the fact that we've optimized out the variable
location for a portion of the program.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353936 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstructionCombining.cpp
test/Transforms/InstCombine/debuginfo-sink.ll [new file with mode: 0644]