https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88971
Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #3)
> (In reply to Richard Biener from comment #1)
> > This is because it still needs to generate the std::string objects at the
> > caller
> > site (outside of the if (print)).  This involves quite some code to get
> > rid of, and even at -O3 we do not inline basic_string::basic_string it seems
> > (ISTR that is out-of-line in the library):
> > 
> >   __asm__ __volatile__("mfence" :  :  : "memory");
> >   _6 = MEM[(const int *)&data + 4B];
> >   if (_6 > 0)
> >     goto <bb 3>; [41.48%]
> >   else
> >     goto <bb 11>; [58.52%]
> > 
> >   <bb 3> [local count: 445388109]:
> >   std::basic_string<char>::basic_string (&D.39204, "<", &D.39205);
> >   _7 = MEM[(char * *)&D.39204];
> >   _8 = _7 + 18446744073709551592;
> >   if (_8 != &_S_empty_rep_storage)
> >     goto <bb 5>; [10.00%]
> >   else
> >     goto <bb 4>; [90.00%]
> 
> Looks like you're using -D_GLIBCXX_USE_CXX11_ABI=0 but the OP is not.

Indeed.  It's still missed inlining that makes elding of the argument
construction difficult.  Looks like

std::__cxx11::basic_string<char>::_M_construct<const char*>

is not marked inline (so needs -finline-functions to get IPA inlining
processing).  Indeed I see

      // For forward_iterators up to random_access_iterators, used for
      // string::iterator, _CharT*, etc.
      template<typename _FwdIterator>
        void
        _M_construct(_FwdIterator __beg, _FwdIterator __end,
                     std::forward_iterator_tag);

and others.

Reply via email to