[llvm] r202106 - [SROA] Add a debugging tool which shuffles the slices sequence prior to

Chandler Carruth chandlerc at gmail.com
Mon Mar 3 19:10:15 PST 2014


On Mon, Mar 3, 2014 at 7:08 PM, Adrian Prantl <aprantl at apple.com> wrote:

> I was thinking about something akin to this (possibly less ugly ;-):
>
> #if __cplusplus >= 201103L && !defined(NDEBUG)
>   if (SROARandomShuffleSlices) {
>
>     std::mt19937 MT(static_cast<unsigned>(sys::TimeValue::now().msec()));
>     std::shuffle(Slices.begin(), Slices.end(), MT);
>     std::stable_sort(Slices.begin(), Slices.end());
>   } else
> #else
>
>   // Sort the uses. This arranges for the offsets to be in ascending order,
>   // and the sizes to be in descending order.
>   std::sort(Slices.begin(), Slices.end());
> #endif
>

There really is no need for this.

The shuffle just adds entropy that sort probably doesn't. It isn't like
sort is going to remove the entropy added by shuffle.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140303/c7aa796c/attachment.html>


More information about the llvm-commits mailing list