[DebugInfo] Recover debug intrinsics when killing duplicated/empty basic blocks
authorstozer <stephen.tozer@sony.com>
Wed, 4 Dec 2019 09:44:02 +0000 (09:44 +0000)
committerstozer <stephen.tozer@sony.com>
Wed, 4 Dec 2019 16:01:49 +0000 (16:01 +0000)
commit72ce759928e6dfee6a9efa310b966c19722352ba
tree7ca2b21eabffe17458b139055ff7f56bdfc51a85
parentb3b37783034cab31db2d60cf79d0c1c82a8c3419
[DebugInfo] Recover debug intrinsics when killing duplicated/empty basic blocks

When basic blocks are killed, either due to being empty or to being an if.then
or if.else block whose complement contains identical instructions, some of the
debug intrinsics in that block are lost. This patch sinks those intrinsics
into the single successor block, setting them Undef if necessary to
prevent debug info from falling out-of-date.

Differential Revision: https://reviews.llvm.org/D70318
llvm/include/llvm/Transforms/Utils/Local.h
llvm/lib/Transforms/Utils/Local.cpp
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/SimplifyCFG/hoist-dbgvalue-else.ll [new file with mode: 0644]
llvm/test/Transforms/SimplifyCFG/hoist-dbgvalue-empty.ll [new file with mode: 0644]