From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F336A3858C60; Thu, 23 Dec 2021 08:04:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F336A3858C60 From: "smal.root at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/59394] Unused code generated Date: Thu, 23 Dec 2021 08:04:47 +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: 4.8.2 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: smal.root at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: attachments.created 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Dec 2021 08:04:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D59394 --- Comment #6 from smalcom --- Created attachment 52050 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52050&action=3Dedit Generated assembly when using "LTO". avr-gcc-10.2 (In reply to Andrew Pinski from comment #4) > If I use -Wl,--gc-sections -ffunction-sections, then all of the unused > (non-static) functions are removed. >=20 > Also -flto is able to optimize it too. I confirm that: 1. With set "-Wl,--gc-sections -ffunction-sections" output file do not cont= ain unused functions (attached gcsec.lss). 2. With "-flto" all functions are inlined and present only used code (attac= hed lto.lss). Tested using gcc-10: avr-gcc -v Using built-in specs. Reading specs from /mnt/stor5/opt/=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B0/avr-10.2.0/bin/../lib/g= cc/avr/10.2.0/device-specs/specs-avr2 COLLECT_GCC=3Davr-gcc COLLECT_LTO_WRAPPER=3D/mnt/stor5/opt/=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B0/a= vr-10.2.0/bin/../libexec/gcc/avr/10.2.0/lto-wrapper Target: avr Configured with: ../configure --prefix=3D/opt/toolchain/avr-10.2.0 --target= =3Davr --enable-languages=3Dc,c++ --disable-nls --disable-libssp --with-dwarf2 Thread model: single Supported LTO compression algorithms: zlib zstd gcc version 10.2.0 (GCC)=20 Great. Thanks!=