summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-01-11 17:31:17 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-01-11 17:31:17 +0000
commit7aafc4d66a52bf0c6f03db4b805b844b3c79dffa (patch)
treed2a229ae28b7ed56abc30aa46d3202f42c1b0740
parentef48e7bccee4f956744564e47b9c932e0605f7a8 (diff)
[libcxx] Call __count_bool_true for bitset count
This patch aims to help clang with better information so it can inline __bit_reference count function usage for both std::biset. Current clang inliner can not infer that the passed typed will be used only to select the optimized variant, it evaluates the type argument and type check as a load plus compare (although later optimization phases correctly optimized this out). It is mainly to help llvm inliner to generate better code for std::bitset count for aarch64. It helps on both runtime and code size, since if inline decides that _VSTD::count should not be inlined the vectorization will create both aligned and unaligned variants (which add both code size and runtime costs) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350936 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/bitset2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/bitset b/include/bitset
index 6e28596d0..98947e027 100644
--- a/include/bitset
+++ b/include/bitset
@@ -991,7 +991,7 @@ inline
size_t
bitset<_Size>::count() const _NOEXCEPT
{
- return static_cast<size_t>(_VSTD::count(base::__make_iter(0), base::__make_iter(_Size), true));
+ return static_cast<size_t>(__count_bool_true(base::__make_iter(0), _Size));
}
template <size_t _Size>