aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/IfConversion.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-05-29 23:37:20 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-05-29 23:37:20 +0000
commit58fbb9f5babf00bd0a0e5b0f39bb718275972ec6 (patch)
tree6c6622067a9a5b014fa52e57f7c011a9ddc93d73 /lib/CodeGen/IfConversion.cpp
parent1f476f4d84028c69777b9d309579209666f45543 (diff)
Don't merge in tail block of a diamond if it has more than one predecessors after if-conversion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37353 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/IfConversion.cpp')
-rw-r--r--lib/CodeGen/IfConversion.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp
index 8e7b0fe45a..a57fba96fb 100644
--- a/lib/CodeGen/IfConversion.cpp
+++ b/lib/CodeGen/IfConversion.cpp
@@ -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);