[SimplifyCFG] Extend SimplifyResume to handle phi of trivial landing pad.
authorChen Li <meloli87@gmail.com>
Thu, 22 Oct 2015 20:48:38 +0000 (20:48 +0000)
committerChen Li <meloli87@gmail.com>
Thu, 22 Oct 2015 20:48:38 +0000 (20:48 +0000)
commitc6e28782d80b8c25a5e76e6a14d812f1f3bf294b
tree55f1abf3d3806fbcdbe18d9fb2d2f8d477aec545
parent1c4059a0c430881111c0b2c51cf98fc7fb559eec
[SimplifyCFG] Extend SimplifyResume to handle phi of trivial landing pad.

Summary: Currently SimplifyResume can convert an invoke instruction to a call instruction if its landing pad is trivial. In practice we could have several invoke instructions with trivial landing pads and share a common rethrow block, and in the common rethrow block, all the landing pads join to a phi node. The patch extends SimplifyResume to check the phi of landing pad and their incoming blocks. If any of them is trivial, remove it from the phi node and convert the invoke instruction to a call instruction.

Reviewers: hfinkel, reames

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D13718

llvm-svn: 251061
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/SimplifyCFG/invoke_unwind.ll