1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Don't crash on critical edge. Patch by Andre Tavares.

llvm-svn: 79252
This commit is contained in:
Nick Lewycky 2009-08-17 17:00:57 +00:00
parent 4643e96d36
commit afaae7957e
2 changed files with 16 additions and 1 deletions

View File

@ -95,7 +95,7 @@ void SSI::insertSigmaFunctions(SmallVectorImpl<Instruction *> &value) {
// Next Basic Block
BasicBlock *BB_next = TI->getSuccessor(j);
if (BB_next != BB &&
BB_next->getUniquePredecessor() != NULL &&
BB_next->getSinglePredecessor() != NULL &&
dominateAny(BB_next, value[i])) {
PHINode *PN = PHINode::Create(
value[i]->getType(), SSI_SIG, BB_next->begin());

View File

@ -0,0 +1,15 @@
; RUN: llvm-as < %s | opt -abcd -disable-output
define void @test(i32 %x) {
entry:
br label %label1
label1:
%A = phi i32 [ 0, %entry ], [ %A.1, %label2 ]
%B = icmp slt i32 %A, %x
br i1 %B, label %label2, label %label2
label2:
%A.1 = add i32 %A, 1
br label %label1
label3: ; No predecessors!
ret void
}