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

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #3 from Mikael Morin <mikael at gcc dot gnu.org> ---
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:

  <bb 10> [local count: 7761689018]:
  foo ();
  pretmp_25 = e;
  goto <bb 15>; [100.00%]

...

  <bb 15> [local count: 8963573811]:
  # j_28 = PHI <1(10), j_30(24), 1(22), j_30(25), 1(26), j_30(20)>
  # i_29 = PHI <i_20(10), 0(24), i_19(22), 0(25), i_21(26), 0(20)>
  # prephitmp_38 = PHI <pretmp_25(10), prephitmp_26(24), prephitmp_26(22),
prephitmp_26(25), prephitmp_26(26), prephitmp_26(20)>
  d.7_22 = d;
  _23 = d.7_22 + 1;
  d = _23;
  if (_23 != 0)
    goto <bb 27>; [94.50%]
  else
    goto <bb 18>; [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':

  <bb 5> [local count: 7761689018]:
  foo ();
  goto <bb 8>; [100.00%]

...

  <bb 8> [local count: 8963573796]:
  # i_28 = PHI <i_13(5), 0(12), i_13(15)>
  d.7_22 = d;
  _23 = d.7_22 + 1;
  d = _23;
  pretmp_10 = e;
  if (_23 != 0)
    goto <bb 17>; [94.50%]
  else
    goto <bb 11>; [5.50%]


Later on this prevents copyprop from simplifying the 'pretmp' and 'prephitmp'
values to 3 and remove the branch calling 'foo'.

  parent reply	other threads:[~2024-04-09  9:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05 15:01 [Bug tree-optimization/111293] New: " theodort at inf dot ethz.ch
2023-09-05 17:25 ` [Bug tree-optimization/111293] " pinskia at gcc dot gnu.org
2023-09-05 17:40 ` pinskia at gcc dot gnu.org
2023-09-05 17:40 ` pinskia at gcc dot gnu.org
2023-11-24 15:56 ` amacleod at redhat dot com
2024-03-07 23:21 ` law at gcc dot gnu.org
2024-04-09  9:38 ` mikael at gcc dot gnu.org [this message]
2024-04-09  9:47 ` mikael at gcc dot gnu.org
2024-05-07  7:41 ` [Bug tree-optimization/111293] [14/15 " 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-111293-4-qS5J6kEz6N@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).