From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 49B9F38A942B; Tue, 11 Jan 2022 10:54:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49B9F38A942B From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/100220] missed optimization for dead code elimination at -O3 (vs. -O1, -Os, -O2) (inlining differences) Date: Tue, 11 Jan 2022 10:54:44 +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: unknown X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka 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: dependson 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: Tue, 11 Jan 2022 10:54:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100220 Jan Hubicka changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |100314 --- Comment #3 from Jan Hubicka --- Here the stack frame size of i is stimated to 244 bytes void i () { int p[8]; int n[27]; int k[24]; int l; int j; int _1; int _2; int _3; int c.2_4; int _5; [local count: 236223200]: l =3D 0; k =3D {}; h =3D &n; _1 =3D n[0]; _2 =3D _1 & 1; if (_2 !=3D 0) goto ; [50.00%] else goto ; [50.00%] [local count: 118111600]: goto ; [100.00%] [local count: 955630225]: _3 =3D c.2_4 + -1; c =3D _3; [local count: 1073741824]: c.2_4 =3D c; if (c.2_4 !=3D 0) goto ; [89.00%] else goto ; [11.00%] [local count: 236223200]: h =3D &p; _5 =3D p[0]; if (_5 !=3D 0) goto ; [50.00%] else goto ; [50.00%] [local count: 118111600]: h =3D &j; [local count: 236223200]: e =3D 0; j =3D{v} {CLOBBER}; l =3D{v} {CLOBBER}; k =3D{v} {CLOBBER}; n =3D{v} {CLOBBER}; p =3D{v} {CLOBBER}; return; } so it indeed has larger arrays. k is initialized but never used (so it is missed DSE). n is used in stupid way: h =3D &n;=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 _1 =3D n[0];=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 where h is write only static var, but we do not know that during early opts= (we could try our luck and schedule one extra writeonly detection before early optimization passes, but I am not sure it is worth). I would say that main issue is also missed DSE Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100314 [Bug 100314] missed optimization for dead code elimination at -O3 (vs. -O1)= =20 (inlining differences due to missed dse)=