Watch out for blocks that end with a return.
authorEvan Cheng <evan.cheng@apple.com>
Fri, 18 May 2007 17:06:53 +0000 (17:06 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 18 May 2007 17:06:53 +0000 (17:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37227 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/IfConversion.cpp

index a98f04b1ef2dbcc351b84d17414c450fd26bafca..a93175ec4146e4f1923b81411fa6a1abe20be67a 100644 (file)
@@ -316,7 +316,7 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI) {
 
     // Either the 'true' block fallthrough to another block or it ends with a
     // return. If it's the former, add a conditional branch to its successor.
-    if (!TrueBBI.TrueBB)
+    if (!TrueBBI.TrueBB && BBI.TrueBB->succ_size())
       TII->InsertBranch(*BBI.TrueBB, *BBI.TrueBB->succ_begin(), NULL, BBI.Cond);
 
     // Predicate the 'false' block.
@@ -326,7 +326,7 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI) {
 
     // Either the 'false' block fallthrough to another block or it ends with a
     // return. If it's the former, add a conditional branch to its successor.
-    if (!FalseBBI.TrueBB)
+    if (!FalseBBI.TrueBB && BBI.FalseBB->succ_size())
       TII->InsertBranch(*BBI.FalseBB, *BBI.FalseBB->succ_begin(), NULL,NewCond);
 
     // Merge the 'true' and 'false' blocks by copying the instructions