[all-commits] [llvm/llvm-project] 7e91ef: [libc++][pstl] Implementation of parallel std::swa...

Michael G. Kazakov via All-commits all-commits at lists.llvm.org
Fri Sep 25 16:14:22 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7e91ef5d6aeaa7191a9354ddcff67d84bd8aebaf
      https://github.com/llvm/llvm-project/commit/7e91ef5d6aeaa7191a9354ddcff67d84bd8aebaf
  Author: Michael G. Kazakov <mike.kazakov at gmail.com>
  Date:   2026-09-26 (Sat, 26 Sep 2026)

  Changed paths:
    M libcxx/include/CMakeLists.txt
    M libcxx/include/__algorithm/pstl.h
    M libcxx/include/__pstl/backend_fwd.h
    M libcxx/include/__pstl/backends/default.h
    M libcxx/include/__pstl/backends/libdispatch.h
    M libcxx/include/__pstl/backends/serial.h
    M libcxx/include/__pstl/backends/std_thread.h
    A libcxx/include/__pstl/cpu_algos/swap_ranges.h
    M libcxx/include/module.modulemap.in
    M libcxx/test/libcxx/algorithms/pstl.iterator-requirements.verify.cpp
    A libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/pstl.swap_ranges.pass.cpp
    M libcxx/test/std/algorithms/pstl.exception_handling.pass.cpp

  Log Message:
  -----------
  [libc++][pstl] Implementation of parallel std::swap_ranges() based on parallel __for_each (#224967)

This PR adds an implementation of parallel `std::swap_ranges()` based on
`__parallel_for_each_iter_pair()`.

The implementation is effectively a one-liner, but has to deal with
iterator ranges, thus is located in `cpu_algos`:
```c++
__pstl::__parallel_for_each_iter_pair<_Backend>(
    first1, last1, first2,
    [](ForwardIterator1 brick_first1, ForwardIterator1 brick_last1, ForwardIterator2 brick_first2) {
        std::swap_ranges(std::move(brick_first1), std::move(brick_last1), std::move(brick_first2));
    });
```

Part of #99938



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list