public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/110361] [13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r13-2020-g16b013c9d9b
Date: Mon, 07 Aug 2023 09:05:21 +0000	[thread overview]
Message-ID: <bug-110361-4-yW0RJzOnf0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110361-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-08-07
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

What is interesting is we have:
```
  <bb 7> [local count: 525923045]:
  g = &p;
  f.0_18 = f;
  if (f.0_18 == 0)
    goto <bb 8>; [50.00%]
  else
    goto <bb 13>; [50.00%]

  <bb 9> [local count: 225485782]:
  g = &p;
  f.0_36 = f;
  if (f.0_36 == 0)
    goto <bb 8>; [50.00%]
  else
    goto <bb 13>; [50.00%]

```
Those bb's are exactly the same.

Their pred bbs are:
```
  <bb 3> [local count: 751619280]:
  if (e.4_19 == &a)
    goto <bb 9>; [30.00%]
  else
    goto <bb 4>; [70.00%]

  <bb 4> [local count: 526133498]:
  if (e.4_19 == &d)
    goto <bb 7>; [99.96%]
  else
    goto <bb 5>; [0.04%]
```

Their succ branch (that matters) is:
```
  <bb 13> [local count: 375914866]:
  c = &m;
  m ={v} {CLOBBER(eol)};
  _22 = e.4_19 == &d;
  _1 = e.4_19 == &a;
  _23 = _1 | _22;
  if (_23 != 0)
    goto <bb 12>; [25.16%]
  else
    goto <bb 10>; [74.84%]
```

So coming into bb13, we know that `(e.4_19 == &d) | (e.4_19 == &a)` is true.
Removing the branch to bb 10 which was the call to foo:
  <bb 10> [local count: 281323581]:
  foo ();

  parent reply	other threads:[~2023-08-07  9:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 11:40 [Bug tree-optimization/110361] New: " theodort at inf dot ethz.ch
2023-06-22 12:58 ` [Bug tree-optimization/110361] " rguenth at gcc dot gnu.org
2023-07-27  9:27 ` rguenth at gcc dot gnu.org
2023-08-07  9:05 ` pinskia at gcc dot gnu.org [this message]
2024-03-08 15:30 ` law at gcc dot gnu.org
2024-05-21  9:16 ` [Bug tree-optimization/110361] [13/14/15 " jakub 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-110361-4-yW0RJzOnf0@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).