OSDN Git Service

Fix for testcase Transforms/IndVarsSimplify/2005-02-11-InvokeCrash.ll
authorChris Lattner <sabre@nondot.org>
Sat, 12 Feb 2005 03:26:49 +0000 (03:26 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 12 Feb 2005 03:26:49 +0000 (03:26 +0000)
and PR504.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20129 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/IndVarSimplify.cpp

index 7ad8ef4..bc86702 100644 (file)
@@ -133,6 +133,8 @@ namespace {
             if ((*UI)->getType() == Ty)
               if (CastInst *CI = dyn_cast<CastInst>(cast<Instruction>(*UI))) {
                 BasicBlock::iterator It = I; ++It;
+                if (isa<InvokeInst>(I))
+                  It = cast<InvokeInst>(I)->getNormalDest()->begin();
                 while (isa<PHINode>(It)) ++It;
                 if (It != BasicBlock::iterator(CI)) {
                   // Splice the cast immediately after the operand in question.