Don't generate branch to entry block.
authorDale Johannesen <dalej@apple.com>
Tue, 8 May 2007 01:01:04 +0000 (01:01 +0000)
committerDale Johannesen <dalej@apple.com>
Tue, 8 May 2007 01:01:04 +0000 (01:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36917 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/CodeGenPrepare.cpp

index cb7d1e8221e65628bd9a5836b32be912333343da..9fa044e4c764ea100c1da1c5eb6dd528cf434463 100644 (file)
@@ -280,7 +280,9 @@ static void SplitEdgeNicely(TerminatorInst *TI, unsigned SuccNum, Pass *P) {
     BranchInst *PredBr = dyn_cast<BranchInst>(Pred->getTerminator());
     if (!PredBr || !PredBr->isUnconditional() ||
         // Must be empty other than the branch.
-        &Pred->front() != PredBr)
+        &Pred->front() != PredBr ||
+        // Cannot be the entry block; its label does not get emitted.
+        Pred == &(Dest->getParent()->getEntryBlock()))
       continue;
     
     // Finally, since we know that Dest has phi nodes in it, we have to make