diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index f3834158c1c..a39ba6eda26 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -632,7 +632,7 @@ void LoopStrengthReduce::runOnLoop(Loop *L) { BasicBlock::iterator I = L->getHeader()->begin(); PHINode *PN; - for (; (PN = dyn_cast(I)); ) { + while ((PN = dyn_cast(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. @@ -664,5 +664,6 @@ void LoopStrengthReduce::runOnLoop(Loop *L) { } IVUsesByStride.clear(); + CastedBasePointers.clear(); return; }