forked from OSchip/llvm-project
parent
7a141b3d88
commit
6d6f10fe91
|
@ -718,6 +718,11 @@ bool JumpThreading::ProcessSwitchOnDuplicateCond(BasicBlock *PredBB,
|
||||||
if (PredSI->getSuccessor(PredCase) != DestBB &&
|
if (PredSI->getSuccessor(PredCase) != DestBB &&
|
||||||
DestSI->getSuccessor(i) != DestBB)
|
DestSI->getSuccessor(i) != DestBB)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Do not forward this if it already goes to this destination, this would
|
||||||
|
// be an infinite loop.
|
||||||
|
if (PredSI->getSuccessor(PredCase) == DestSucc)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Otherwise, we're safe to make the change. Make sure that the edge from
|
// Otherwise, we're safe to make the change. Make sure that the edge from
|
||||||
// DestSI to DestSucc is not critical and has no PHI nodes.
|
// DestSI to DestSucc is not critical and has no PHI nodes.
|
||||||
|
|
|
@ -212,3 +212,25 @@ bb13:
|
||||||
bb61:
|
bb61:
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; PR5698
|
||||||
|
define void @test7(i32 %x) {
|
||||||
|
tailrecurse:
|
||||||
|
switch i32 %x, label %return [
|
||||||
|
i32 2, label %bb2
|
||||||
|
i32 3, label %bb
|
||||||
|
]
|
||||||
|
|
||||||
|
bb:
|
||||||
|
switch i32 %x, label %return [
|
||||||
|
i32 2, label %bb2
|
||||||
|
i32 3, label %tailrecurse
|
||||||
|
]
|
||||||
|
|
||||||
|
bb2:
|
||||||
|
ret void
|
||||||
|
|
||||||
|
return:
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue