From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 151AA385AC11; Thu, 25 Aug 2022 05:48:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 151AA385AC11 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661406511; bh=gaV5mzyKrT9ogc2pGpPpvIruPJe8GN8ThOp/SUtXq4s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MYouW7+04AYkaRqOcTEJkh13AUN1c39fS7y3fMp37uzZhmIVY+htQ4F5Ufl4N79G8 u0wAVSWFVAFWFzXsCLFmTs7JlskbMwmdwCj7Wl2HXT//mBVHrZqCWYkzKitccaw9v7 Dbxc8OVIr7fm0RW0jwdeRuJyKf1TmUwEt1KBkWxA= From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/106725] LTO semantics for __attribute__((leaf)) Date: Thu, 25 Aug 2022 05:48:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: documentation, lto X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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=3D106725 --- Comment #3 from rguenther at suse dot de --- On Wed, 24 Aug 2022, dthorn at google dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106725 >=20 > --- Comment #2 from Daniel Thornburgh --- > (In reply to Richard Biener from comment #1) > > If GCC, with LTO, would partition the program into two LTRANS partition= s, > > one containing main and bar and one containing foo then applying this > > optimization promise during LTRANS time on the main/bar partition would > > be wrong as you say - but I think GCC doesn't do this. >=20 > In this case, foo() was already compiled to native code outside of LTO. > Wouldn't this then mean that its contents wouldn't be available for the W= PA and > LTRANS phases of the LTO code generation? It seems like the compiler woul= dn't > know that foo() might call bar(), and the presence of `__attribute__((lea= f))` > would cause it to assume that it doesn't call bar(). As said, GCC shouldn't assume this since leaf is defined at translation unit level, not at LTO level.=