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

--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 22 Jan 2019, maratrus at mail dot ru wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88971
> 
> --- Comment #5 from Marat Stanichenko <maratrus at mail dot ru> ---
> 
> (In reply to Richard Biener from comment #1)
> > This is because it still needs to generate the std::string objects at the
> > caller
> 
> Thank you very much for the comment! That is probably why I had to add another
> string parameter to the function `PrintBad` in the example provided to trigger
> this behaviour. The fact is that in the production environment where I managed
> to spot this, the compiler could not optimize the function that is very 
> similar
> to `PrintGood` and has just a single string parameter. I didn't manage to
> reproduce it when simplifying things while preparing a test-case here.
> 
> Do you believe that compiler can do better in such situations? Or the current
> behaviour is perfectly valid and no improvements are really needed?

The compiler can of course do better when estimating the benefit of
inlining.  It's just not entirely clear if it is reasonably easy to
do so ... [let aside the -finline-function issue]

Reply via email to