From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8AC833858C39; Tue, 9 Apr 2024 09:38:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8AC833858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712655491; bh=t3LbJZNijUhX7YHQVSjMEStgMDYPopy7mRBV6ggvAkI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=E7+mpqSYLXDgxN0OjMoxcmYpfirSF2PYaMc4H/qz2mSuxXTBsB8aVpEH3jdvzXHmZ Qzh3rte2Mam3+lBdkI7MsOl5fCSvBV36rae/HbJ9DnAgbcDLdjLVYwpXNU0wn5rjIR 90uHTDOp95rc0W60sn3rE/xTvvoLvnN2JRJx1OO4= From: "mikael at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111293] [14 Regression] Missed Dead Code Elimination since r14-3414-g0cfc9c953d0 Date: Tue, 09 Apr 2024 09:38:09 +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: mikael at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D111293 Mikael Morin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikael at gcc dot gnu.org --- Comment #3 from Mikael Morin --- pre replaces usages of the 'e' global with a set of 'pretmp' and 'prephitmp' ssa registers. With gcc-13, the value of 'e' is reloaded directly after the call to 'foo', and that value is joined with a phi in the next bb: [local count: 7761689018]: foo (); pretmp_25 =3D e; goto ; [100.00%] ... [local count: 8963573811]: # j_28 =3D PHI <1(10), j_30(24), 1(22), j_30(25), 1(26), j_30(20)> # i_29 =3D PHI # prephitmp_38 =3D PHI d.7_22 =3D d; _23 =3D d.7_22 + 1; d =3D _23; if (_23 !=3D 0) goto ; [94.50%] else goto ; [5.50%] With gcc-14, the value of 'e' is reloaded later in the next bb, causing a dependency on 'e', even on paths not calling 'foo': [local count: 7761689018]: foo (); goto ; [100.00%] ... [local count: 8963573796]: # i_28 =3D PHI d.7_22 =3D d; _23 =3D d.7_22 + 1; d =3D _23; pretmp_10 =3D e; if (_23 !=3D 0) goto ; [94.50%] else goto ; [5.50%] Later on this prevents copyprop from simplifying the 'pretmp' and 'prephitm= p' values to 3 and remove the branch calling 'foo'.=