diff options
author | Chris Lattner <sabre@nondot.org> | 2003-12-10 20:43:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-12-10 20:43:04 +0000 |
commit | 88369d214f320e888cb0bcb98db10ff8f47602a2 (patch) | |
tree | af1b4200332504bd62d615892f9e74d1969e81e2 /lib/Transforms/Scalar | |
parent | da7d0693b570778e98188b26c28a3ee155890b8e (diff) | |
download | external_llvm-88369d214f320e888cb0bcb98db10ff8f47602a2.zip external_llvm-88369d214f320e888cb0bcb98db10ff8f47602a2.tar.gz external_llvm-88369d214f320e888cb0bcb98db10ff8f47602a2.tar.bz2 |
Fix bug: IndVarsSimplify/2003-12-10-RemoveInstrCrash.llx
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10385 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/IndVarSimplify.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 369be47..ed5aca3 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -140,6 +140,8 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) { DEBUG(IV->print(std::cerr)); + while (isa<PHINode>(AfterPHIIt)) ++AfterPHIIt; + // Don't do math with pointers... const Type *IVTy = IV->Phi->getType(); if (isa<PointerType>(IVTy)) IVTy = Type::ULongTy; @@ -204,6 +206,9 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) { PHIOps.insert(PHIOps.end(), MaybeDead->op_begin(), MaybeDead->op_end()); MaybeDead->getParent()->getInstList().erase(MaybeDead); + + // Erasing the instruction could invalidate the AfterPHI iterator! + AfterPHIIt = Header->begin(); } } |