[libcxx-commits] [PATCH] D146421: [release/16.x][libc++] Revert the bitset sort optimization

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 28 06:27:29 PDT 2023


ldionne added a comment.

Thanks for chiming in. So under the Debug mode we also currently have something that will check that the comparator is consistent. It doesn't change the complexity of the algorithm, but it does double the number of times the comparator is called. The debug mode is not really "productized" right now, turning it on also turns on other checks that are less desirable because they require taking a global lock, are incompatible with constexpr, etc.

Shuffling the range wouldn't help here -- the problem wasn't non-determinism in the output, it's that we literally go and read out-of-bounds when the comparator is wrong. I think this is happening in `__insertion_sort_unguarded`, and I think I can add an assertion check just in there to "fix" the issue but I haven't had time to get the reproducer integrated in our test suite yet.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146421/new/

https://reviews.llvm.org/D146421



More information about the libcxx-commits mailing list