Fix PR312 and IndVarsSimplify/2004-04-05-InvokeCastCrash.llx

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12668 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-04-05 18:46:55 +00:00
parent 1b151b4a3b
commit ddd947f21a

View 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 {