From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9809A3865C12; Thu, 18 Jan 2024 13:12:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9809A3865C12 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705583574; bh=Mw1/iT41zJvUvssAqJFMO1p/x4Nbsl0DQtLvyEvy2R4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZhXqzoKyt/Oi7DwKR/Z4pCsTsCN7llrhBBShJoQkUIq9wGcRhR/fQQ2Ra/tsPCK5S /ioRNoaeWkQC38heu5gy/2RXRsomo47UZT9Booi4U/0bt7lDb7RGDe4DBZ5NccVJCa sd97IinqfhbsqVo286Z+E4OOA+NP8gH1aPaJWANs= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/113478] -Os does not inline single instruction function Date: Thu, 18 Jan 2024 13:12:53 +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: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW 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: bug_status everconfirmed cf_reconfirmed_on cc component 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=3D113478 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2024-01-18 CC| |hubicka at gcc dot gnu.org Component|c++ |ipa --- Comment #1 from Richard Biener --- t.C:35:19: note: Considering inline candidate T D::test() [with T =3D char]/231. Estimating body: T D::test() [with T =3D char]/231 Known to be false: not inlined, op0 changed size:4 Estimating body: T D::test() [with T =3D char]/231 Known to be false: not inlined, op0 changed size:4 t.C:35:19: missed: will not early inline: int main()/185->T D::test() [with T =3D char]/231, call is cold and code would grow by 1 which is because Analyzing function body size: T D::test() [with T =3D char]/231 Accounting size:2.00, time:0.00 on new predicate exec:(not inlined) BB 2 predicate:(true) _3 =3D &MEM[(const struct __atomic_base *)this_1(D)]._M_i; freq:1.00 size: 0 time: 0 _4 =3D __atomic_load_1 (_3, 0); freq:1.00 size: 4 time: 13 _5 =3D (char) _4; freq:1.00 size: 0 time: 0 return _5; freq:1.00 size: 1 time: 2 Will be eliminated by inlining Accounting size:1.00, time:2.00 on predicate exec:(not inli= ned) so the __atomic_load_1 "call"s are not special-cased during size estimation and we assume you'd get parameter setup and call. Note some targets might expand this to a call to libatomic (there's also -finline-atomics). We might want to consider improving heuristics here.=