From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19185 invoked by alias); 25 Feb 2015 22:27:20 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19133 invoked by uid 48); 25 Feb 2015 22:27:17 -0000 From: "glisse at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/59948] Optimize std::function Date: Thu, 26 Feb 2015 00:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: glisse at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg02858.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59948 --- Comment #7 from Marc Glisse --- There has been huge progress in gcc-5: int m() () { struct function h; : MEM[(int (*) (int) *)&h] = f; h._M_invoker = _M_invoke; h.D.27699._M_manager = _M_manager; std::_Function_base::_Base_manager::_M_manager (&MEM[(struct _Function_base *)&h]._M_functor, &MEM[(struct _Function_base *)&h]._M_functor, 3); h ={v} {CLOBBER}; return 0; } Apparently we managed to inline f! For this simple testcase, all that is missing is inlining _M_manager to realize that when the last argument is 3 it does nothing. Then we can go back to more complicated examples like the one linked at the end of comment #0.