From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CD84F3858419; Tue, 19 Mar 2024 21:38:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD84F3858419 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710884329; bh=Nnbdi2+ntMS6tG5ALXA5UyWuoFzz585AzmBLdEINDGk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=G47JYVS42eq87mcxPnGnqicqtdnUJUVpB6ySyrNPnupU8k8O/zWnpuRl4h0xWfrJv ZcebZ8MhQLMdbo4YOwT5reLVX+SmlZRozsf7pR7+BP0iNbPIQaSIYRBp/geiuoTWWV 1TFttExIYcV7Y7mER3BqS8ST4/Ii+3H3xX/uwBlU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/114254] [11/12/13/14 regression] Indirect inlining through C++ member pointers fails if the underlying class has a virtual function Date: Tue, 19 Mar 2024 21:38:47 +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: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jamborm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114254 --- Comment #2 from GCC Commits --- The master branch has been updated by Martin Jambor : https://gcc.gnu.org/g:bf838884fac573b4902a21bb82d9b6f777e32cb9 commit r14-9559-gbf838884fac573b4902a21bb82d9b6f777e32cb9 Author: Martin Jambor Date: Tue Mar 19 22:33:27 2024 +0100 ipa: Fix C++ member ptr indirect inlining (PR 114254, PR 108802) Even though we have had code to handle creation of indirect call graph edges (so that these calls can than be made direct as part of IPA-CP and inlining and eventually also inlined) for C++ member pointers for many years, it turns out that it does not work for lambdas and that it has been severely broken since GCC 10 when the base class has virtual functions. Lambdas don't work because the code cannot work with structures representing member function pointers because they are passed by reference instead by value and the code was not ready for that. The presence of virtual methods broke thinks because at some point C++ FE got clever and stopped emitting the check for virtual methods when the base class does not have any and that in turn made our existing testcases not test the necessary pattern matching code. The pattern matcher had a small bug which did not matter before r10-917-g3b47da42de621c but did afterwards. This patch changes the pattern matcher to match both of these cases. gcc/ChangeLog: 2024-03-06 Martin Jambor PR ipa/108802 PR ipa/114254 * ipa-prop.cc (ipa_get_stmt_member_ptr_load_param): Fix case looking at COMPONENT_REFs directly from a PARM_DECL, also recognize loa= ds from a pointer parameter. (ipa_analyze_indirect_call_uses): Also recognize loads from a pointer parameter, also recognize the case when pfn pointer is loaded in its own BB. gcc/testsuite/ChangeLog: 2024-03-06 Martin Jambor PR ipa/108802 PR ipa/114254 * g++.dg/ipa/iinline-4.C: New test. * g++.dg/ipa/pr108802.C: Likewise.=