summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit20f7d30f929062f9d6a086625cba328bf2af5286 (patch)
treebf3019f546243a1db23ad20146be3794e8bb2665 /llvm/lib/CodeGen/IfConversion.cpp
parent9429cd1a615b4298bde1f1113a9375b1daf444bf (diff)
downloadbcm5719-llvm-20f7d30f929062f9d6a086625cba328bf2af5286.tar.gz
bcm5719-llvm-20f7d30f929062f9d6a086625cba328bf2af5286.zip
Don't merge in tail block of a diamond if it has more than one predecessors after if-conversion.
llvm-svn: 37353
Diffstat (limited to 'llvm/lib/CodeGen/IfConversion.cpp')
-rw-r--r--llvm/lib/CodeGen/IfConversion.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp
index 8e7b0fe45a4..a57fba96fb6 100644
--- a/llvm/lib/CodeGen/IfConversion.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud