In addition to removing phi nodes this patch removes any landing pad the dead exit block might have.
Without this fix Verifier complains about a new switch instruction jumps to a block with a landing pad:
Block containing LandingPadInst must be jumped to only by the unwind edge of an invoke. %res = landingpad token cleanup in function test_remove_lpad LLVM ERROR: Broken function found, compilation aborted!
Regression tests provided.
Why do we only delete phis and landingpad? If this block is proved dead, we can remove all its instructions and insert unreachable instead of its terminator.