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 | 564900e5e5039bcde465aa6d2daa7efe3f3d344b (patch) | |
| tree | e33350c7d6525a37712f581165c6f178859647df /llvm/lib/Transforms | |
| parent | fca31aee4fd5c8bc9aa2df36dbf51b1e206a455d (diff) | |
| download | bcm5719-llvm-564900e5e5039bcde465aa6d2daa7efe3f3d344b.tar.gz bcm5719-llvm-564900e5e5039bcde465aa6d2daa7efe3f3d344b.zip | |
Fix an iterator invalidation problem
llvm-svn: 22575
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index f06cf33c138..0967fb7200b 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/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 |

