diff options
author | Chris Lattner <sabre@nondot.org> | 2005-08-02 00:41:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-08-02 00:41:11 +0000 |
commit | 1060e09fb207ed778581957671f8803d2df3a581 (patch) | |
tree | f5e787aeada9971eab53f2981bf079c9d81f9288 /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | 8dcd5483bce94be0ac02dd5c8b749a9a2458ee2b (diff) |
Fix an iterator invalidation problem
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index f06cf33c13..0967fb7200 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -622,7 +622,9 @@ void LoopStrengthReduce::runOnLoop(Loop *L) { BasicBlock::iterator I = L->getHeader()->begin(); PHINode *PN; - for (; (PN = dyn_cast<PHINode>(I)); ++I) { + for (; (PN = dyn_cast<PHINode>(I)); ) { + ++I; // Preincrement iterator to avoid invalidating it when deleting PN. + // At this point, we know that we have killed one or more GEP instructions. // It is worth checking to see if the cann indvar is also dead, so that we // can remove it as well. The requirements for the cann indvar to be |