llvm.org GIT mirror llvm / a10e89f
Don't crash on critical edge. Patch by Andre Tavares. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79252 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 10 years ago
2 changed file(s) with 16 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
9494 // Next Basic Block
9595 BasicBlock *BB_next = TI->getSuccessor(j);
9696 if (BB_next != BB &&
97 BB_next->getUniquePredecessor() != NULL &&
97 BB_next->getSinglePredecessor() != NULL &&
9898 dominateAny(BB_next, value[i])) {
9999 PHINode *PN = PHINode::Create(
100100 value[i]->getType(), SSI_SIG, BB_next->begin());
0 ; RUN: llvm-as < %s | opt -abcd -disable-output
1
2 define void @test(i32 %x) {
3 entry:
4 br label %label1
5 label1:
6 %A = phi i32 [ 0, %entry ], [ %A.1, %label2 ]
7 %B = icmp slt i32 %A, %x
8 br i1 %B, label %label2, label %label2
9 label2:
10 %A.1 = add i32 %A, 1
11 br label %label1
12 label3: ; No predecessors!
13 ret void
14 }