[PATCH] D39245: [ADT] Shuffle containers before sorting to uncover non-deterministic behavior
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 14:17:26 PDT 2017
dexonsmith added a comment.
> std::sort and array_pod_sort both use quicksort
FWIW, most standards-compliant std::sort implementations use introsort... although it's also unstable.
> NOTE: To randomly shuffle before std::sort we may have to change all calls to std::sort with llvm::sort.
It looks to me like the current overloads of llvm::sort take a parallel execution policy, which would be unfortunate boilerplate to add. Perhaps you should create an overload in ADT/STLExtras.h with the same signature as std::sort (that wraps std::sort with the initial call to std::random_shuffle).
Repository:
rL LLVM
https://reviews.llvm.org/D39245
More information about the llvm-commits
mailing list