SimplifyCFG: fold unconditional branch to its predecessor if profitable.
authorManman Ren <mren@apple.com>
Wed, 13 Jun 2012 05:43:29 +0000 (05:43 +0000)
committerManman Ren <mren@apple.com>
Wed, 13 Jun 2012 05:43:29 +0000 (05:43 +0000)
commitee28e0fdd1955d9fe7acc05b3250ceee759ac3c6
tree7e88f8e1466aedaf73e9643afdfb6a9e88400701
parent764dc754fe52c3a61363fad341b68be397103668
SimplifyCFG: fold unconditional branch to its predecessor if profitable.

This patch extends FoldBranchToCommonDest to fold unconditional branches.
For unconditional branches, we fold them if it is easy to update the phi nodes
in the common successors.

rdar://10554090

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