[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)
commitf4a0ff09a8ebffd2ebaaa11d45e40a684e8ed018
tree61a617a26eb667d2891467d90603922a93d769b5
parentc417afc0987687af79a1f47a292a940c49f86dec
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251061 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/invoke_unwind.ll