public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/59948] Optimize std::function Date: Wed, 29 Jan 2014 13:27:00 -0000 [thread overview] Message-ID: <bug-59948-4-MIzHRcmxIg@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-59948-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59948 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2014-01-29 CC| |hubicka at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- Honza will know the correct condition ... As for optimization the issue is that <bb 2>: MEM[(struct _Function_base *)&h]._M_manager = 0B; MEM[(int (*<T5869>) (int) *)&h] = f; h._M_invoker = _M_invoke; h.D.26161._M_manager = _M_manager; _4 = std::function<int(int)>::operator() (&h, 1); <bb 3>: _5 = _4; _11 = MEM[(struct _Function_base *)&h]._M_manager; if (_11 != 0B) goto <bb 4>; else goto <bb 5>; <bb 4>: _11 (&MEM[(struct _Function_base *)&h]._M_functor, &MEM[(struct _Function_base *)&h]._M_functor, 3); the call to std::function<int(int)>::operator() (&h, 1) may clobber h and thus the _M_manager field. This function is not early-inlined at -O[23] and thus the call is not made direct before IPA inlining (or earlier). Considering inline candidate _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = int; _ArgTypes = {int}]. Estimating body: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = int; _ArgTypes = {int}]/360 Known to be false: not inlined size:10 time:21 Estimating body: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = int; _ArgTypes = {int}]/360 Known to be false: not inlined size:10 time:21 will not early inline: int m()/273->_Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = int; _ArgTypes = {int}]/360, growth 6 exceeds --param early-inlining-insns divided by number of calls forcing that with --param early-inlining-insns=100 arrives at <bb 2>: MEM[(struct _Function_base *)&h]._M_manager = 0B; MEM[(int (*<T5869>) (int) *)&h] = f; h._M_invoker = _M_invoke; h.D.26161._M_manager = _M_manager; _14 = std::_Function_handler<int(int), int (*)(int)>::_M_invoke (&h.D.26161._M_functor, 1); <bb 3>: _15 = MEM[(struct _Function_base *)&h]._M_manager; which has the same problem - just with another function call which the early inliner doesn't see.
next prev parent reply other threads:[~2014-01-29 13:27 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-01-26 11:31 [Bug ipa/59948] New: " glisse at gcc dot gnu.org 2014-01-26 13:24 ` [Bug ipa/59948] " glisse at gcc dot gnu.org 2014-01-29 13:27 ` rguenth at gcc dot gnu.org [this message] 2014-02-04 2:35 ` hubicka at gcc dot gnu.org 2014-02-04 3:00 ` hubicka at gcc dot gnu.org 2014-05-02 14:06 ` glisse at gcc dot gnu.org 2014-09-26 16:54 ` hubicka at gcc dot gnu.org 2015-02-26 0:09 ` glisse at gcc dot gnu.org 2023-09-25 9:04 ` hubicka at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-59948-4-MIzHRcmxIg@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).