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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libstdc++                   |tree-optimization

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
here is the current IR (with -fno-exceptions) at -O3:

  MEM[(struct basic_string *)&s] ={v} {CLOBBER};
  MEM[(struct _Alloc_hider *)&s] ={v} {CLOBBER};
  MEM[(struct _Alloc_hider *)&s]._M_p = &s.D.26433._M_local_buf;
  __builtin_memcpy (&s.D.26433._M_local_buf, "abc", 3);
  s._M_string_length = 3;
  MEM[(char_type &)&s + 19] = 0;
  foo ();
  _3 = s._M_dataplus._M_p;
  if (&s.D.26433._M_local_buf != _3)
    goto <bb 3>; [53.47%]
  else
    goto <bb 4>; [46.53%]

  <bb 3> [local count: 574129753]:
  _7 = s.D.26433._M_allocated_capacity;
  _8 = _7 + 1;
  operator delete (_3, _8);

for some reason GCC thinks foo can modify s so the load for s._M_dataplus._M_p
is not be optimized to just &s.D.26433._M_local_buf

Reply via email to