aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-01-10 11:56:56 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-01-10 11:56:56 +0100
commit6cdf1946f6eed116552026cfeb44a669ee882ccf (patch)
tree9e0df4647c48c61b0be61e9fa0ab0c1f4ded7f28 /libstdc++-v3
parentdbf02a2cd6652a1e95cce0ea5035ac394c023a00 (diff)
downloadgcc-6cdf1946f6eed116552026cfeb44a669ee882ccf.zip
gcc-6cdf1946f6eed116552026cfeb44a669ee882ccf.tar.gz
gcc-6cdf1946f6eed116552026cfeb44a669ee882ccf.tar.bz2
re PR tree-optimization/88775 (Optimize std::string assignment)
PR tree-optimization/88775 * include/bits/stl_function.h (greater<_Tp*>::operator(), less<_Tp*>::operator(), greater_equal<_Tp*>::operator(), less_equal<_Tp*>::operator()): Use __builtin_is_constant_evaluated instead of __builtin_constant_p if available. Don't bother with the pointer comparison in C++11 and earlier. From-SVN: r267800
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog9
-rw-r--r--libstdc++-v3/include/bits/stl_function.h32
2 files changed, 37 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 7ab044b..4e248d4 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,12 @@
+2019-01-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/88775
+ * include/bits/stl_function.h (greater<_Tp*>::operator(),
+ less<_Tp*>::operator(), greater_equal<_Tp*>::operator(),
+ less_equal<_Tp*>::operator()): Use __builtin_is_constant_evaluated
+ instead of __builtin_constant_p if available. Don't bother with
+ the pointer comparison in C++11 and earlier.
+
2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
PR other/16615
diff --git a/libstdc++-v3/include/bits/stl_function.h b/libstdc++-v3/include/bits/stl_function.h
index 0d6c388..358b9aa 100644
--- a/libstdc++-v3/include/bits/stl_function.h
+++ b/libstdc++-v3/include/bits/stl_function.h
@@ -413,8 +413,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX14_CONSTEXPR bool
operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW
{
- if (__builtin_constant_p (__x > __y))
+#if __cplusplus >= 201402L
+#ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
+ if (__builtin_is_constant_evaluated())
+#else
+ if (__builtin_constant_p(__x > __y))
+#endif
return __x > __y;
+#endif
return (__UINTPTR_TYPE__)__x > (__UINTPTR_TYPE__)__y;
}
};
@@ -426,8 +432,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX14_CONSTEXPR bool
operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW
{
- if (__builtin_constant_p (__x < __y))
+#if __cplusplus >= 201402L
+#ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
+ if (__builtin_is_constant_evaluated())
+#else
+ if (__builtin_constant_p(__x < __y))
+#endif
return __x < __y;
+#endif
return (__UINTPTR_TYPE__)__x < (__UINTPTR_TYPE__)__y;
}
};
@@ -439,8 +451,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX14_CONSTEXPR bool
operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW
{
- if (__builtin_constant_p (__x >= __y))
+#if __cplusplus >= 201402L
+#ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
+ if (__builtin_is_constant_evaluated())
+#else
+ if (__builtin_constant_p(__x >= __y))
+#endif
return __x >= __y;
+#endif
return (__UINTPTR_TYPE__)__x >= (__UINTPTR_TYPE__)__y;
}
};
@@ -452,8 +470,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX14_CONSTEXPR bool
operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW
{
- if (__builtin_constant_p (__x <= __y))
+#if __cplusplus >= 201402L
+#ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
+ if (__builtin_is_constant_evaluated())
+#else
+ if (__builtin_constant_p(__x <= __y))
+#endif
return __x <= __y;
+#endif
return (__UINTPTR_TYPE__)__x <= (__UINTPTR_TYPE__)__y;
}
};