SimplifyCFG: sink common codes from IF, ELSE blocks down to END block.
authorManman Ren <mren@apple.com>
Thu, 20 Sep 2012 22:37:36 +0000 (22:37 +0000)
committerManman Ren <mren@apple.com>
Thu, 20 Sep 2012 22:37:36 +0000 (22:37 +0000)
commit554da1a222eaeea71636700ca2b7dd931e81ade6
tree867b1c2a0de8a793ea3ce06e9009a95c85e3423b
parent2dad6b501b5148faef16b85cfea59d7462bad0fd
SimplifyCFG: sink common codes from IF, ELSE blocks down to END block.

We already have HoistThenElseCodeToIf, this patch implements
SinkThenElseCodeToEnd. When END block has only two predecessors and each
predecessor terminates with unconditional branches, we compare instructions in
IF and ELSE blocks backwards and check whether we can sink the common
instructions down.

rdar://12191395

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164325 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/sink-common-code.ll [new file with mode: 0644]