From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0AF953857C76; Fri, 22 Oct 2021 06:57:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0AF953857C76 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102880] [12 Regression] Dead Code Elimination Regression at -O3 Date: Fri, 22 Oct 2021 06:57:26 +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: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords bug_status target_milestone assigned_to 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: Fri, 22 Oct 2021 06:57:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102880 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|missed-optimization | Status|NEW |ASSIGNED Target Milestone|--- |12.0 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org --- Comment #3 from Richard Biener --- The difference after DSE1 is (for main): @@ -235,20 +251,9 @@ : b.11_31 =3D b; - if (b.11_31 !=3D 0) - goto ; [INV] - else - goto ; [INV] : - - : - # iftmp.9_36 =3D PHI <1(13), 0(14)> - d.12_32 =3D d; - _33 =3D d.12_32 & iftmp.9_36; - - : - # iftmp.7_35 =3D PHI <1(10), 0(15)> + # iftmp.7_35 =3D PHI <1(10), 0(11), 0(13), 0(12)> _34 =3D (short int) iftmp.7_35; ai =3D _34; return 0; where this then causes less CDDCE: -marking necessary through iftmp.7_35 stmt iftmp.7_35 =3D PHI <1(10), 0(15)> -processing: iftmp.7_35 =3D PHI <1(10), 0(15)> +marking necessary through iftmp.7_35 stmt iftmp.7_35 =3D PHI <1(10), 0(11), 0(13), 0(12)> +processing: iftmp.7_35 =3D PHI <1(10), 0(11), 0(13), 0(12)> Marking useful stmt: if (e.8_26 !=3D 0) +Marking useful stmt: if (iftmp.14_83 !=3D 0) + +Marking useful stmt: if (_28 !=3D 0) + +processing: if (_28 !=3D 0) + +marking necessary through _28 stmt _28 =3D (char) ah.10_27; +processing: _28 =3D (char) ah.10_27; + +marking necessary through ah.10_27 stmt ah.10_27 =3D ah; +processing: ah.10_27 =3D ah; + +processing: if (iftmp.14_83 !=3D 0) + +marking necessary through iftmp.14_83 stmt iftmp.14_83 =3D a.part.0 (1, _2= 9); +processing: iftmp.14_83 =3D a.part.0 (1, _29); + +marking necessary through _29 stmt _29 =3D (int) _28; +processing: _29 =3D (int) _28; + the key here is I guess that if we'd split the CFG so that PHIs only have _different_ arguments we would be able to reduce the number of control dependences. That seems like a general issue of CD-DCE, in this case exposed by the extra DCE from DSE which in turn triggers block merging from CFG cleanup (we trigger that once we removed a PHI which we did). Now the question is whether there's a good way to alter the control dependence query in a way to make this work without factoring the PHIs first. I suppose querying control dependence of the common dominator of the same-argument PHI edges might work.=