[llvm] r208286 - Revert "SCEV: Use I = vector<>.erase(I) to iterate and delete at the same time"

Tobias Grosser tobias at grosser.es
Thu May 8 14:41:06 PDT 2014


On 08/05/2014 22:16, Benjamin Kramer wrote:
>
> On 08.05.2014, at 09:55, Tobias Grosser <tobias at grosser.es> wrote:
>
>> Author: grosser
>> Date: Thu May  8 02:55:34 2014
>> New Revision: 208286
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=208286&view=rev
>> Log:
>> Revert "SCEV: Use I = vector<>.erase(I) to iterate and delete at the same time"
>>
>> as committed in r208282. The original commit was incorrect.
>
> This looks like a perfect candidate for std::remove_if. It also avoids the O(n^2) behavior you get by calling erase on a vector in a loop.

I like this suggestion. It makes it very clear that we do not mistakenly
get the iterators wrong. Committed in r208357.

Tobias



More information about the llvm-commits mailing list