[Bug tree-optimization/86573] Failure to optimise passing simple values to inlined function

2018-07-19 Thread s_gccbugzilla at nedprod dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86573

--- Comment #8 from Niall Douglas  ---
Added revised bug to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86590

[Bug tree-optimization/86573] Failure to optimise passing simple values to inlined function

2018-07-19 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86573

--- Comment #7 from Marc Glisse  ---
The real difference in -std=c++17 is _GLIBCXX_EXTERN_TEMPLATE. With -std=c++14,
we have many extern templates which the compiler almost never inlines. This
leaves existing inline functions small enough to be inlined in main (once it is
renamed). With -std=c++17, extern templates are gone, everything is inlined,
and the function that used to be small enough to be inlined is now too big
(several smaller functions have been inlined into it first). Without inlining,
the compiler cannot notice all the simplifications.
(this is in large part guesswork, feel free to verify)

If someone wants to improve it, I would look into the inliner heuristics, but
that's probably going to be hard.

[Bug tree-optimization/86573] Failure to optimise passing simple values to inlined function

2018-07-19 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86573

--- Comment #6 from Richard Biener  ---
(In reply to Niall Douglas from comment #5)
> Thanks for the rapid feedback. Very very interesting that -std=c++17 causes
> spew for the copy case https://godbolt.org/g/Xnrgg2, yet -std=c++14 or
> -std=c++11 does not.
> 
> Is the -std=c++17 case worth opening a new bug report for?

I guess so (same for -std=c++2a btw)

[Bug tree-optimization/86573] Failure to optimise passing simple values to inlined function

2018-07-19 Thread s_gccbugzilla at nedprod dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86573

--- Comment #5 from Niall Douglas  ---
Thanks for the rapid feedback. Very very interesting that -std=c++17 causes
spew for the copy case https://godbolt.org/g/Xnrgg2, yet -std=c++14 or
-std=c++11 does not.

Is the -std=c++17 case worth opening a new bug report for?

[Bug tree-optimization/86573] Failure to optimise passing simple values to inlined function

2018-07-19 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86573

--- Comment #4 from Richard Biener  ---
Note we only manage to optimize it with the C++11 std::string.

[Bug tree-optimization/86573] Failure to optimise passing simple values to inlined function

2018-07-18 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86573

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
 Status|UNCONFIRMED |RESOLVED
  Component|c++ |tree-optimization
Version|tree-ssa|7.0
 Resolution|--- |INVALID

--- Comment #3 from Andrew Pinski  ---
Using f instead of main allows it be optimized so closing as invalid.  NOTE GCC
has a heuristic around main function being done as ever called once so it does
less inlining into it.