From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 85A453858408; Mon, 25 Mar 2024 10:41:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85A453858408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711363279; bh=uYSLUyTHx1IVkkuQjQr+PqeaBYRp3f1VRA8mcWyAWy4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kQNVq4dWiRvdmvliMukXycra7BhoM/hMf8kEc3jkM/jcV96iE31wO4g9x+iW6d1Rg zO+0BBdtLp76Ik/r2mq3fQz5qkGJwCnWWtzPP+pelFO3fQQnbYw87X9k979iAu4zZP Azfs7JbtlLpr8oCEOmF2D0yLExUKuWIonvWDrfbM= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/114452] Functions invoked through compile-time table of function pointers not inlined Date: Mon, 25 Mar 2024 10:41:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xry111 at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE 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: 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=3D114452 --- Comment #3 from Xi Ruoyao --- (In reply to Pawe=C5=82 Bylica from comment #2) > I don't think this is related to lambdas. The following is also not > optimized: >=20 >=20 > using F =3D int (*)(int) noexcept; >=20 > inline int impl(int x) noexcept { return x; } >=20 > void test(int z[2]) noexcept { > static constexpr F fs[]{ > impl, > impl, > }; >=20 > for (int i =3D 0; i < 2; ++i) { > z[i] =3D fs[i](z[i]); > } > } >=20 > https://godbolt.org/z/9hPbzo4Px The analysis of PR111573 says: "So we fail to inline since ipa-prop fails to track the constant function address. I think this is really common in typical lambda function usage" "fails to track the constant function address" applies for normal functions too.=