From 6f34e317e956da45a8015fe89e4b2ce4d7814fc3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 19 Jan 2009 21:20:34 +0000 Subject: Fix PR3353, infinitely jump threading an infinite loop make from switches. llvm-svn: 62529 --- llvm/lib/Transforms/Scalar/JumpThreading.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib') diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index 94d33aa7879..f96fc208ae1 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -419,6 +419,11 @@ bool JumpThreading::ProcessBranchOnDuplicateCond(BasicBlock *PredBB, /// switches out of repeated 'if' conditions. bool JumpThreading::ProcessSwitchOnDuplicateCond(BasicBlock *PredBB, BasicBlock *DestBB) { + // Can't thread edge to self. + if (PredBB == DestBB) + return false; + + SwitchInst *PredSI = cast(PredBB->getTerminator()); SwitchInst *DestSI = cast(DestBB->getTerminator()); -- cgit v1.2.3