Fix PR312 and IndVarsSimplify/2004-04-05-InvokeCastCrash.llx
authorChris Lattner <sabre@nondot.org>
Mon, 5 Apr 2004 18:46:55 +0000 (18:46 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 5 Apr 2004 18:46:55 +0000 (18:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12668 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index e75229c0675fcdc02d65b97974eac919e7dfec7b..8e6ee5363ae4974115da9e02ae45dcb5a1a9d422 100644 (file)
@@ -2478,6 +2478,8 @@ Value *ScalarEvolutionRewriter::ExpandCodeFor(SCEVHandle SH,
   else if (Instruction *I = dyn_cast<Instruction>(V)) {
     // FIXME: check to see if there is already a cast!
     BasicBlock::iterator IP = I; ++IP;
+    if (InvokeInst *II = dyn_cast<InvokeInst>(I))
+      IP = II->getNormalDest()->begin();
     while (isa<PHINode>(IP)) ++IP;
     return new CastInst(V, Ty, V->getName(), IP);
   } else {