On Thu, 26 Jul 2018, Martin Liška wrote:

Following patch implements new predictors that annotates malloc-like functions.
These almost every time return a non-null value.

Out of curiosity (the __builtin_expect there doesn't hurt and we don't need to remove it), does it make __builtin_expect unnecessary in the implementation of operator new (libstdc++-v3/libsupc++/new_op.cc)? It looks like

  while (__builtin_expect ((p = malloc (sz)) == 0, false))
    {
      new_handler handler = std::get_new_handler ();
      if (! handler)
        _GLIBCXX_THROW_OR_ABORT(bad_alloc());
      handler ();
    }

where being in a loop may trigger opposite heuristics.

--
Marc Glisse

Reply via email to