From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 15732386D604; Thu, 15 Feb 2024 23:08:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15732386D604 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708038482; bh=YYCXC5t1m4huEv1+xrJeTvbLeFv/n0ErBMwHZgsq1ZY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Pnls2X7WLSyKPt+H/4Hv4yoyLiiSCA5eQ0fJnQewMV2fYywjgNFr/Fb2cFq6ITg+w xMOul1HL2M+MXoNRWMKoJTJ6OJDfQUCf1PNPMm9GMMu5WNld34l6unNaOZVDC4KpeC etmW72dirUPBlSh1rU6BXIup/XbC4zMrQNmcKq3A= From: "roger at nextmovesoftware dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112508] [14 Regression] Size regression when using -Os starting with r14-4089-gd45ddc2c04e Date: Thu, 15 Feb 2024 23:08:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: roger at nextmovesoftware dot com 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: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status everconfirmed cc cf_reconfirmed_on 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=3D112508 Roger Sayle changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 CC| |roger at nextmovesoftware = dot com Last reconfirmed| |2024-02-15 --- Comment #2 from Roger Sayle --- The issue appears to be with (poor costing in) loop invariant store motion.= =20 Adding the command line option "-fno-move-loop-stores" reduces the .s file = from 149 lines to 54 lines, and the size of main (as reported by objdump -d) from 317 bytes to 73 bytes. To confirm that this isn't specific to this (possi= bly pathological/obscure) test case, I ran the CSiBE benchmark on x86_64, compa= ring "-Os" to "-Os -fno-move-loop-stores", which shows a net saving of 1606 bytes with -fno-move-loop-stores. There are cases where -fno-move-loop-stores reduces code size (on x86_64, and I've not investigated other targets), so I guess it would be preferrable to use more accurate size costs instead of ju= st disabling this sub-pass. Note that the bigger hammer, -fno-tree-loop-im, al= so avoids the code growth, but the more precise/specific -fno-move-loop-stores= is sufficient.=