[SimplifyCFG] Do not blindly remove unreachable blocks
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 24 Feb 2016 10:02:16 +0000 (10:02 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 24 Feb 2016 10:02:16 +0000 (10:02 +0000)
commitec72e3722033762fdbf828f1ff8ec2cf406411c8
tree3850d5f3e50e062601f573ea65632fb7f394042f
parente2ad73759d80376f3d450d05843bd86ac408c221
[SimplifyCFG] Do not blindly remove unreachable blocks

DeleteDeadBlock was called indiscriminately, leading to cleanuprets with
undef cleanuppad references.

Instead, try to drain the BB of most of it's instructions if it is
unreachable.  We can then remove the BB if it solely consists of a
terminator (and maybe some phis).

llvm-svn: 261731
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/SimplifyCFG/unreachable-cleanuppad.ll [new file with mode: 0644]