[libcxx-commits] [libcxx] [libc++] Optimize std::remove (PR #107756)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Sep 8 07:49:09 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 4a505e15e768011e47101cf9aeb0c7787fdc9acf 983d3477338be496c187e969631d438239e62a9f --extensions h,cpp -- libcxx/test/benchmarks/algorithms/remove.bench.cpp libcxx/include/__algorithm/count.h libcxx/include/__algorithm/remove.h libcxx/include/__algorithm/simd_utils.h libcxx/include/__bit/popcount.h libcxx/include/__stop_token/atomic_unique_lock.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__algorithm/remove.h b/libcxx/include/__algorithm/remove.h
index b2ac7018c4..2c9c1a7dbd 100644
--- a/libcxx/include/__algorithm/remove.h
+++ b/libcxx/include/__algorithm/remove.h
@@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, __enable_if_t<__has_compressstore<__simd_vector<_Tp, __native_vector_size<_Tp>>>, int> = 0>
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp*
__remove(_Tp* __first, _Tp* __last, const _Tp& __val) {
- __first = std::find(__first, __last, __val);
+ __first = std::find(__first, __last, __val);
constexpr size_t __vec_size = __native_vector_size<_Tp>;
using __vec = __simd_vector<_Tp, __vec_size>;
diff --git a/libcxx/test/benchmarks/algorithms/remove.bench.cpp b/libcxx/test/benchmarks/algorithms/remove.bench.cpp
index 17cda19ec0..8277afca2f 100644
--- a/libcxx/test/benchmarks/algorithms/remove.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/remove.bench.cpp
@@ -31,9 +31,7 @@ struct remove_every_second {
struct remove_random {
std::shared_ptr<std::mt19937> rng = std::make_shared<std::mt19937>(std::random_device{}());
- std::size_t operator()() {
- return (*rng)();
- }
+ std::size_t operator()() { return (*rng)(); }
};
template <class T, class Generator>
``````````
</details>
https://github.com/llvm/llvm-project/pull/107756
More information about the libcxx-commits
mailing list