public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-102880-4-jxJkMjIIv8@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102880-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102880

Richard Biener <rguenth at gcc dot gnu.org> 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 <rguenth at gcc dot gnu.org> ---
The difference after DSE1 is (for main):

@@ -235,20 +251,9 @@

   <bb 13> :
   b.11_31 = b;
-  if (b.11_31 != 0)
-    goto <bb 15>; [INV]
-  else
-    goto <bb 14>; [INV]

   <bb 14> :
-
-  <bb 15> :
-  # iftmp.9_36 = PHI <1(13), 0(14)>
-  d.12_32 = d;
-  _33 = d.12_32 & iftmp.9_36;
-
-  <bb 17> :
-  # iftmp.7_35 = PHI <1(10), 0(15)>
+  # iftmp.7_35 = PHI <1(10), 0(11), 0(13), 0(12)>
   _34 = (short int) iftmp.7_35;
   ai = _34;
   return 0;

where this then causes less CDDCE:

-marking necessary through iftmp.7_35 stmt iftmp.7_35 = PHI <1(10), 0(15)>
-processing: iftmp.7_35 = PHI <1(10), 0(15)>
+marking necessary through iftmp.7_35 stmt iftmp.7_35 = PHI <1(10), 0(11),
0(13), 0(12)>
+processing: iftmp.7_35 = PHI <1(10), 0(11), 0(13), 0(12)>

 Marking useful stmt: if (e.8_26 != 0)

+Marking useful stmt: if (iftmp.14_83 != 0)
+
+Marking useful stmt: if (_28 != 0)
+
+processing: if (_28 != 0)
+
+marking necessary through _28 stmt _28 = (char) ah.10_27;
+processing: _28 = (char) ah.10_27;
+
+marking necessary through ah.10_27 stmt ah.10_27 = ah;
+processing: ah.10_27 = ah;
+
+processing: if (iftmp.14_83 != 0)
+
+marking necessary through iftmp.14_83 stmt iftmp.14_83 = a.part.0 (1, _29);
+processing: iftmp.14_83 = a.part.0 (1, _29);
+
+marking necessary through _29 stmt _29 = (int) _28;
+processing: _29 = (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.

  parent reply	other threads:[~2021-10-22  6:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 13:27 [Bug tree-optimization/102880] New: " theodort at inf dot ethz.ch
2021-10-21 13:46 ` [Bug tree-optimization/102880] " marxin at gcc dot gnu.org
2021-10-22  6:56 ` pinskia at gcc dot gnu.org
2021-10-22  6:57 ` rguenth at gcc dot gnu.org [this message]
2021-10-22  8:44 ` rguenth at gcc dot gnu.org
2021-10-29  9:09 ` rguenth at gcc dot gnu.org
2021-11-11 12:42 ` rguenth at gcc dot gnu.org
2021-11-16 10:31 ` cvs-commit at gcc dot gnu.org
2021-11-16 10:32 ` cvs-commit at gcc dot gnu.org
2021-11-16 10:33 ` rguenth at gcc dot gnu.org
2021-11-17  8:41 ` clyon at gcc dot gnu.org
2021-11-17  8:47 ` pinskia at gcc dot gnu.org
2021-11-18  8:56 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-102880-4-jxJkMjIIv8@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).