fix PR5698

llvm-svn: 90708
This commit is contained in:
Chris Lattner
2009-12-06 17:17:23 +00:00
parent 7a141b3d88
commit 6d6f10fe91
2 changed files with 27 additions and 0 deletions

View File

@@ -718,6 +718,11 @@ bool JumpThreading::ProcessSwitchOnDuplicateCond(BasicBlock *PredBB,
if (PredSI->getSuccessor(PredCase) != DestBB &&
DestSI->getSuccessor(i) != DestBB)
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
// DestSI to DestSucc is not critical and has no PHI nodes.