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/112542] [14 Regression] Dead Code Elimination Regression since r14-4280-gc3c6f30496d
Date: Wed, 15 Nov 2023 16:48:59 +0000	[thread overview]
Message-ID: <bug-112542-4-jjN2fyTnFG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112542-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-11-15
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
  _7 = (char) c.2_5;
...
  _26 = _7 == 0;
  _27 = c.2_5 == 0;
  _28 = _26 & _27;
  if (_28 != 0)
```
we transform this into:
```
  _26 = _7 == 0;
  _27 = c.2_5 == 0;
  if (c.2_5 == 0)
```
During FRE1
Which is correct. and _26 goes away later on.

Then in evpr GCC changes:
```
  # iftmp.8_29 = PHI <_7(4), 0(5)>

```
into:
```
  # iftmp.8_29 = PHI <-1(4), 0(5)>
```

Which is also correct.

Where it goes wrong is vrp1.

We end up with this mess:
```
  b.0_1 = b;
  _2 = b.0_1 == 0;
  _4 = (int) _2;
  c = _4;
  i.7_12 = (unsigned int) _2;
  _16 = b.0_1 != 0;
  _15 = _16 ? 1 : 2;
  if (_15 == 2)
    goto <bb 3>; [0.00%]
  else
    goto <bb 4>; [100.00%]

  <bb 3> [count: 0]:
  __builtin_unreachable ();
```

But that is basically:
```
...
if (b.0_1 == 0) __builtin_unreachable();
```

  parent reply	other threads:[~2023-11-15 16:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15  9:42 [Bug tree-optimization/112542] New: " theodort at inf dot ethz.ch
2023-11-15 11:59 ` [Bug tree-optimization/112542] " rguenth at gcc dot gnu.org
2023-11-15 16:48 ` pinskia at gcc dot gnu.org [this message]
2024-03-07 21:02 ` law at gcc dot gnu.org
2024-05-07  7:42 ` [Bug tree-optimization/112542] [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-112542-4-jjN2fyTnFG@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).