[llvm] r208282 - SCEV: Use I = vector<>.erase(I) to iterate and delete at the same time
Tobias Grosser
tobias at grosser.es
Thu May 8 00:12:45 PDT 2014
Author: grosser
Date: Thu May 8 02:12:44 2014
New Revision: 208282
URL: http://llvm.org/viewvc/llvm-project?rev=208282&view=rev
Log:
SCEV: Use I = vector<>.erase(I) to iterate and delete at the same time
Modified:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=208282&r1=208281&r2=208282&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Thu May 8 02:12:44 2014
@@ -7223,12 +7223,9 @@ static void findArrayDimensionsRec(Scala
Terms[I] = Q;
}
- // Remove all SCEVConstants.
- for (unsigned I = 0; I < Terms.size();)
- if (isa<SCEVConstant>(Terms[I]))
- Terms.erase(Terms.begin() + I);
- else
- ++I;
+ for (auto I = Terms.begin(), E = Terms.end(); I != E; I++)
+ if (isa<SCEVConstant>(*I))
+ I = Terms.erase(I);
if (Terms.size() > 0)
findArrayDimensionsRec(SE, Terms, Sizes, Zero, One);
More information about the llvm-commits
mailing list