Don't merge in tail block of a diamond if it has more than one predecessors after if-conversion.

llvm-svn: 37353
This commit is contained in:
Evan Cheng 2007-05-29 23:37:20 +00:00
parent 9429cd1a61
commit 20f7d30f92
1 changed files with 4 additions and 2 deletions

View File

@ -555,9 +555,11 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI) {
} else
InsertUncondBranch(BBI.BB, CvtBBI->BB, TII);
// If the if-converted block fallthrough into the tail block, then
// If the if-converted block fallthrough or unconditionally branch into the
// tail block, and the tail block does not have other predecessors, then
// fold the tail block in as well.
if (BBI.TailBB && CvtBBI->BB->succ_size() == 1) {
if (BBI.TailBB &&
BBI.TailBB->succ_size() == 1 && CvtBBI->BB->succ_size() == 1) {
CvtBBI->NonPredSize -= TII->RemoveBranch(*CvtBBI->BB);
BBInfo TailBBI = BBAnalysis[BBI.TailBB->getNumber()];
MergeBlocks(*CvtBBI, TailBBI);