Clean up some problems with extra CFG edges being introduced during
authorBob Wilson <bob.wilson@apple.com>
Sat, 26 Jun 2010 04:27:33 +0000 (04:27 +0000)
committerBob Wilson <bob.wilson@apple.com>
Sat, 26 Jun 2010 04:27:33 +0000 (04:27 +0000)
commitccd9bcca14e7046b7078cdf472a9185b86cdf07d
tree9f9a66e399e80712cb1380e98ed9bfcde6d24c3b
parent52e4a0a074b758ad3dbf6841b249aaf3baf08f28
Clean up some problems with extra CFG edges being introduced during
if-conversion.  The RemoveExtraEdges function doesn't work for blocks that
end with unanalyzable branches, so in those cases, the "extra" edges must
be explicitly removed.  The CopyAndPredicateBlock and MergeBlocks methods
can also avoid copying successor edges due to branches that have already
been removed.  The latter case is especially helpful when MergeBlocks is
called for handling "diamond" if-conversions, where otherwise you can end
up with some weird intermediate states in the CFG.  Unfortunately I've
been unable to find cases where this cleanup actually makes a significant
difference in the code.  There is one test where we manage to remove an
empty block at the end of a function.  Radar 6911268.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106939 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/IfConversion.cpp
test/CodeGen/Thumb2/thumb2-ifcvt3.ll