[libcxx] r324989 - Fix typos.
Author: brucem Date: Tue Feb 13 00:12:00 2018 New Revision: 324989 URL: http://llvm.org/viewvc/llvm-project?rev=324989&view=rev Log: Fix typos. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43224 Modified: libcxx/trunk/docs/DesignDocs/AvailabilityMarkup.rst libcxx/trunk/docs/DesignDocs/CapturingConfigInfo.rst Modified: libcxx/trunk/docs/DesignDocs/AvailabilityMarkup.rst URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/AvailabilityMarkup.rst?rev=324989&r1=324988&r2=324989&view=diff == --- libcxx/trunk/docs/DesignDocs/AvailabilityMarkup.rst (original) +++ libcxx/trunk/docs/DesignDocs/AvailabilityMarkup.rst Tue Feb 13 00:12:00 2018 @@ -58,7 +58,7 @@ Testing Some parameters can be passed to lit to run the test-suite and exercising the availability. -* The `platform` parameter controls the deployement target. For example lit can +* The `platform` parameter controls the deployment target. For example lit can be invoked with `--param=platform=macosx10.8`. Default is the current host. * The `use_system_cxx_lib` parameter indicates to use another library than the just built one. Invoking lit with `--param=use_system_cxx_lib=true` will run Modified: libcxx/trunk/docs/DesignDocs/CapturingConfigInfo.rst URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/CapturingConfigInfo.rst?rev=324989&r1=324988&r2=324989&view=diff == --- libcxx/trunk/docs/DesignDocs/CapturingConfigInfo.rst (original) +++ libcxx/trunk/docs/DesignDocs/CapturingConfigInfo.rst Tue Feb 13 00:12:00 2018 @@ -46,7 +46,7 @@ we do NOTHING. Otherwise we create a custom installation rule that modifies the installed __config header. The rule first generates a dummy "__config_site" header containing the required -#defines. The contents of the dummy header are then prependend to the installed +#defines. The contents of the dummy header are then prepended to the installed __config header. By manually prepending the files we avoid the cost of an extra #include and we allow the __config header to be ignorant of the extra configuration all together. An example "__config" header generated when ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r325087 - Fix incorrect indentation.
Author: brucem Date: Tue Feb 13 16:29:38 2018 New Revision: 325087 URL: http://llvm.org/viewvc/llvm-project?rev=325087&view=rev Log: Fix incorrect indentation. Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43167 Modified: libcxx/trunk/include/ios Modified: libcxx/trunk/include/ios URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ios?rev=325087&r1=325086&r2=325087&view=diff == --- libcxx/trunk/include/ios (original) +++ libcxx/trunk/include/ios Tue Feb 13 16:29:38 2018 @@ -670,7 +670,7 @@ protected: void set_rdbuf(basic_streambuf* __sb); private: basic_ostream* __tie_; - mutable int_type __fill_; +mutable int_type __fill_; }; template ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25241: [libcxx] Improve code generation for vector::clear().
brucem created this revision. brucem added a subscriber: cfe-commits. By manipulating a local variable in the loop, when the loop can be optimized away (due to no non-trivial destructors), this lets it be fully optimized away and we modify the __end_ separately. This results in a substantial improvement in the generated code. Prior to this change, this would be generated (on x86_64): movq(%rdi), %rdx movq8(%rdi), %rcx cmpq%rdx, %rcx jeLBB2_2 leaq-12(%rcx), %rax subq%rdx, %rax movabsq$-6148914691236517205, %rdx ## imm = 0xAAAB mulq%rdx shrq$3, %rdx notq%rdx leaq(%rdx,%rdx,2), %rax leaq(%rcx,%rax,4), %rax movq%rax, 8(%rdi) And after: movq(%rdi), %rax movq%rax, 8(%rdi) This brings this in line with what other implementations do. https://reviews.llvm.org/D25241 Files: include/vector test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp Index: test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp === --- /dev/null +++ test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp @@ -0,0 +1,35 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// + +// void clear(); + +#include +#include + +#include "min_allocator.h" + +int main() +{ +{ +int a[] = {1, 2, 3}; +std::vector c(a, a+3); +c.clear(); +assert(c.empty()); +} +#if TEST_STD_VER >= 11 +{ +int a[] = {1, 2, 3}; +std::vector> c(a, a+3); +c.clear(); +assert(c.empty()); +} +#endif +} Index: include/vector === --- include/vector +++ include/vector @@ -413,8 +413,10 @@ void __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT { -while (__new_last != __end_) -__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_)); +pointer __soon_to_be_end = __end_; +while (__new_last != __soon_to_be_end) +__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end)); +__end_ = __new_last; } template Index: test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp === --- /dev/null +++ test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp @@ -0,0 +1,35 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// + +// void clear(); + +#include +#include + +#include "min_allocator.h" + +int main() +{ +{ +int a[] = {1, 2, 3}; +std::vector c(a, a+3); +c.clear(); +assert(c.empty()); +} +#if TEST_STD_VER >= 11 +{ +int a[] = {1, 2, 3}; +std::vector> c(a, a+3); +c.clear(); +assert(c.empty()); +} +#endif +} Index: include/vector === --- include/vector +++ include/vector @@ -413,8 +413,10 @@ void __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT { -while (__new_last != __end_) -__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_)); +pointer __soon_to_be_end = __end_; +while (__new_last != __soon_to_be_end) +__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end)); +__end_ = __new_last; } template ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25241: [libcxx] Improve code generation for vector::clear().
brucem updated this revision to Diff 73790. brucem added a comment. Address comments from mclow. https://reviews.llvm.org/D25241 Files: include/vector test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp Index: test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp === --- /dev/null +++ test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp @@ -0,0 +1,39 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// + +// void clear(); + +#include +#include + +#include "min_allocator.h" + +int main() +{ +{ +int a[] = {1, 2, 3}; +std::vector c(a, a+3); +c.clear(); +assert(c.empty()); +LIBCPP_ASSERT(c.__invariants()); +LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); +} +#if TEST_STD_VER >= 11 +{ +int a[] = {1, 2, 3}; +std::vector> c(a, a+3); +c.clear(); +assert(c.empty()); +LIBCPP_ASSERT(c.__invariants()); +LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); +} +#endif +} Index: include/vector === --- include/vector +++ include/vector @@ -413,8 +413,10 @@ void __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT { -while (__new_last != __end_) -__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_)); +pointer __soon_to_be_end = __end_; +while (__new_last != __soon_to_be_end) +__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end)); +__end_ = __new_last; } template Index: test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp === --- /dev/null +++ test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp @@ -0,0 +1,39 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// + +// void clear(); + +#include +#include + +#include "min_allocator.h" + +int main() +{ +{ +int a[] = {1, 2, 3}; +std::vector c(a, a+3); +c.clear(); +assert(c.empty()); +LIBCPP_ASSERT(c.__invariants()); +LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); +} +#if TEST_STD_VER >= 11 +{ +int a[] = {1, 2, 3}; +std::vector> c(a, a+3); +c.clear(); +assert(c.empty()); +LIBCPP_ASSERT(c.__invariants()); +LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); +} +#endif +} Index: include/vector === --- include/vector +++ include/vector @@ -413,8 +413,10 @@ void __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT { -while (__new_last != __end_) -__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_)); +pointer __soon_to_be_end = __end_; +while (__new_last != __soon_to_be_end) +__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end)); +__end_ = __new_last; } template ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r298601 - [libcxx] Improve code generation for vector::clear().
Author: brucem Date: Thu Mar 23 09:39:23 2017 New Revision: 298601 URL: http://llvm.org/viewvc/llvm-project?rev=298601&view=rev Log: [libcxx] Improve code generation for vector::clear(). Summary: By manipulating a local variable in the loop, when the loop can be optimized away (due to no non-trivial destructors), this lets it be fully optimized away and we modify the __end_ separately. This results in a substantial improvement in the generated code. Prior to this change, this would be generated (on x86_64): movq(%rdi), %rdx movq8(%rdi), %rcx cmpq%rdx, %rcx jeLBB2_2 leaq-12(%rcx), %rax subq%rdx, %rax movabsq$-6148914691236517205, %rdx ## imm = 0xAAAB mulq%rdx shrq$3, %rdx notq%rdx leaq(%rdx,%rdx,2), %rax leaq(%rcx,%rax,4), %rax movq%rax, 8(%rdi) And after: movq(%rdi), %rax movq%rax, 8(%rdi) This brings this in line with what other implementations do. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25241 Added: libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp Modified: libcxx/trunk/include/vector Modified: libcxx/trunk/include/vector URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=298601&r1=298600&r2=298601&view=diff == --- libcxx/trunk/include/vector (original) +++ libcxx/trunk/include/vector Thu Mar 23 09:39:23 2017 @@ -413,8 +413,10 @@ inline _LIBCPP_INLINE_VISIBILITY void __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT { -while (__new_last != __end_) -__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_)); +pointer __soon_to_be_end = __end_; +while (__new_last != __soon_to_be_end) +__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end)); +__end_ = __new_last; } template Added: libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp?rev=298601&view=auto == --- libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp (added) +++ libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp Thu Mar 23 09:39:23 2017 @@ -0,0 +1,40 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// + +// void clear(); + +#include +#include + +#include "min_allocator.h" +#include "asan_testing.h" + +int main() +{ +{ +int a[] = {1, 2, 3}; +std::vector c(a, a+3); +c.clear(); +assert(c.empty()); +LIBCPP_ASSERT(c.__invariants()); +LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); +} +#if TEST_STD_VER >= 11 +{ +int a[] = {1, 2, 3}; +std::vector> c(a, a+3); +c.clear(); +assert(c.empty()); +LIBCPP_ASSERT(c.__invariants()); +LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); +} +#endif +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25241: [libcxx] Improve code generation for vector::clear().
brucem marked 2 inline comments as done. brucem added a comment. These have been addressed, so this should be good for further review. https://reviews.llvm.org/D25241 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits