https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117639

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jwakely at redhat dot com,
                   |                            |mjambor at suse dot cz

--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
clang inlines _M_realloc_append at -O2/-O3 while we don't even at -O3. In
general not inlining makes sense since it is quite big and called infrequently.
Maybe we can propagate some stuff to make it smaller for inliner in this
special case.

Without inlining it is hard to track what _M_realloc_append does to the array
and optimize out paired allocations.

~/trunk-install-new5/bin/g++ -O3 lp.C -fdump-tree-all-details --param
max-inline-insns-auto=500

yields to following optimized dump:

void p ()
{
  unsigned int i;
  double _58;
  signed int _292;

  <bb 2> [local count: 566793954]:

  <bb 3> [local count: 495962352]:
  # i_81 = PHI <1(2), i_53(5)>
  _292 = (signed int) i_81;
  _58 = (double) _292;
  if (_58 u> 0.0)
    goto <bb 5>; [99.95%]
  else
    goto <bb 4>; [0.05%]

  <bb 4> [local count: 247978]:
  __builtin_log (_58);

  <bb 5> [local count: 495962352]:
  i_53 = i_81 + 1;
  if (i_53 != 100000000)
    goto <bb 3>; [97.84%]
  else
    goto <bb 6>; [2.16%]

  <bb 6> [local count: 10737416]:
  return;

}         

so we keep code around because we do not eliminate log. -fno-math-errno solves
that. Does std::log need to set errno?

Reply via email to