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

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Oct 2 17:24:51 PDT 2012


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.

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.

/jakob



More information about the llvm-commits mailing list