From 3080cf16a5d1126a4a750b24840d7876302c79fe Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Thu, 8 May 2014 07:55:34 +0000 Subject: [PATCH] Revert "SCEV: Use I = vector<>.erase(I) to iterate and delete at the same time" as committed in r208282. The original commit was incorrect. llvm-svn: 208286 --- llvm/lib/Analysis/ScalarEvolution.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 8f5a2a98cc16..148e58d548f1 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -7223,9 +7223,12 @@ static void findArrayDimensionsRec(ScalarEvolution &SE, Terms[I] = Q; } - for (auto I = Terms.begin(), E = Terms.end(); I != E; I++) - if (isa(*I)) - I = Terms.erase(I); + // Remove all SCEVConstants. + for (unsigned I = 0; I < Terms.size();) + if (isa(Terms[I])) + Terms.erase(Terms.begin() + I); + else + ++I; if (Terms.size() > 0) findArrayDimensionsRec(SE, Terms, Sizes, Zero, One);