[llvm-commits] [llvm] r165073 - in /llvm/trunk: include/llvm/ADT/SetVector.h lib/Transforms/Scalar/SROA.cpp

Chandler Carruth chandlerc at gmail.com
Tue Oct 2 17:43:30 PDT 2012


On Tue, Oct 2, 2012 at 5:24 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk>wrote:

>
> On Oct 2, 2012, at 5:03 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
>
> > Switch the SetVector::remove_if implementation to use partition which
> > preserves the values of the relocated entries, unlikely remove_if. This
> > allows walking them and erasing them.
>
> This can reorder the elements in an unspecified way, causing the SetVector
> iteration order to depend on the C++ library implementation.
>

Oof....


> And stable_partition calls malloc()…
>
> I would call find_if() followed by an explicit loop. Or you could do swaps
> with vector_.back() to avoid moving all the vector elements.
>

I can go back to my original idea for solving this: make a predicate that
calls the set_.erase(). I think that's slightly better than open coding any
of these loops.... It's just a wrapper predicate.


>
> /jakob
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121002/a32fc64f/attachment.html>


More information about the llvm-commits mailing list