Author: spop Date: Thu Aug 11 11:51:48 2016 New Revision: 278356 URL: http://llvm.org/viewvc/llvm-project?rev=278356&view=rev Log: Add 'inline' attribute to __init to inline the basic_string's constructor
basic_string's constructor calls init which was not getting inlined. This prevented optimization of const string as init would appear as a call in between a string's def and use. Patch by Laxman Sole and Aditya Kumar. Differential Revision: https://reviews.llvm.org/D22782 Modified: libcxx/trunk/include/string Modified: libcxx/trunk/include/string URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=278356&r1=278355&r2=278356&view=diff ============================================================================== --- libcxx/trunk/include/string (original) +++ libcxx/trunk/include/string Thu Aug 11 11:51:48 2016 @@ -1442,6 +1442,7 @@ basic_string<_CharT, _Traits, _Allocator } template <class _CharT, class _Traits, class _Allocator> +inline _LIBCPP_INLINE_VISIBILITY void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz, size_type __reserve) { @@ -1466,6 +1467,7 @@ basic_string<_CharT, _Traits, _Allocator } template <class _CharT, class _Traits, class _Allocator> +inline _LIBCPP_INLINE_VISIBILITY void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz) { @@ -1603,6 +1605,7 @@ basic_string<_CharT, _Traits, _Allocator #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _CharT, class _Traits, class _Allocator> +inline _LIBCPP_INLINE_VISIBILITY void basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) { @@ -1699,6 +1702,7 @@ basic_string<_CharT, _Traits, _Allocator template <class _CharT, class _Traits, class _Allocator> template <class _InputIterator> +inline _LIBCPP_INLINE_VISIBILITY typename enable_if < __is_exactly_input_iterator<_InputIterator>::value, @@ -1726,6 +1730,7 @@ basic_string<_CharT, _Traits, _Allocator template <class _CharT, class _Traits, class _Allocator> template <class _ForwardIterator> +inline _LIBCPP_INLINE_VISIBILITY typename enable_if < __is_forward_iterator<_ForwardIterator>::value, _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits