From 4be4287a60f685ef8e050eceb34dd38ad8fd7f57 Mon Sep 17 00:00:00 2001 From: marxin Date: Fri, 10 Aug 2018 11:40:40 +0000 Subject: [PATCH] Remove not needed __builtin_expect due to malloc predictor. 2018-08-10 Martin Liska * libsupc++/new_op.cc (new): Remove __builtin_expect as malloc predictor can handle that. * libsupc++/new_opa.cc: Likewise. * libsupc++/new_opnt.cc (new): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263470 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/libsupc++/new_op.cc | 2 +- libstdc++-v3/libsupc++/new_opa.cc | 2 +- libstdc++-v3/libsupc++/new_opnt.cc | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c76324ccdd3..347c9e30532 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2018-08-10 Martin Liska + + * libsupc++/new_op.cc (new): Remove __builtin_expect as malloc + predictor can handle that. + * libsupc++/new_opa.cc: Likewise. + * libsupc++/new_opnt.cc (new): Likewise. + 2018-08-10 Sebastian Huber PR target/85904 diff --git a/libstdc++-v3/libsupc++/new_op.cc b/libstdc++-v3/libsupc++/new_op.cc index 3a1e38d9df7..3caa0bab2ea 100644 --- a/libstdc++-v3/libsupc++/new_op.cc +++ b/libstdc++-v3/libsupc++/new_op.cc @@ -47,7 +47,7 @@ operator new (std::size_t sz) _GLIBCXX_THROW (std::bad_alloc) if (sz == 0) sz = 1; - while (__builtin_expect ((p = malloc (sz)) == 0, false)) + while ((p = malloc (sz)) == 0) { new_handler handler = std::get_new_handler (); if (! handler) diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc index 68eac5b8ceb..a27ff843ca1 100644 --- a/libstdc++-v3/libsupc++/new_opa.cc +++ b/libstdc++-v3/libsupc++/new_opa.cc @@ -126,7 +126,7 @@ operator new (std::size_t sz, std::align_val_t al) #endif using __gnu_cxx::aligned_alloc; - while (__builtin_expect ((p = aligned_alloc (align, sz)) == 0, false)) + while ((p = aligned_alloc (align, sz)) == 0) { new_handler handler = std::get_new_handler (); if (! handler) diff --git a/libstdc++-v3/libsupc++/new_opnt.cc b/libstdc++-v3/libsupc++/new_opnt.cc index a2dc33ad4d3..faab44e66c2 100644 --- a/libstdc++-v3/libsupc++/new_opnt.cc +++ b/libstdc++-v3/libsupc++/new_opnt.cc @@ -40,7 +40,7 @@ operator new (std::size_t sz, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT if (sz == 0) sz = 1; - while (__builtin_expect ((p = malloc (sz)) == 0, false)) + while ((p = malloc (sz)) == 0) { new_handler handler = std::get_new_handler (); if (! handler) -- 2.11.4.GIT