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/110891] [14 Regression] Dead Code Elimination Regression since r14-2674-gd0de3bf9175
Date: Sat, 26 Aug 2023 00:00:35 +0000	[thread overview]
Message-ID: <bug-110891-4-L2PrMii4Wt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110891-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
One thing I noticed (I don't know if causes the missed optimization) is that we
have before PRE:
```
  <bb 4> [local count: 1073531371]:
  if (a.0_1 != 0)
    goto <bb 6>; [50.00%]
  else
    goto <bb 5>; [50.00%]

  <bb 5> [local count: 536765686]:
  if (_28 == &d)
    goto <bb 9>; [30.00%]
  else
    goto <bb 7>; [70.00%]

  <bb 6> [local count: 536765685]:
  if (_28 == &d)
    goto <bb 9>; [30.00%]
  else
    goto <bb 7>; [70.00%]
```
Which obvious should just be `if (_28 == &d) goto bb9; else goto bb7;` and not
check `a.0_1` at all.

I tried a reduced testcase but PRE optimizes it:
```
int g();
int h();

int j, l;

int f(int a, int *b)
{
        if (a == 0)
        {
                if (b == &j) goto L9; else goto L7;
        }
        else
        {
                if (b == &j) goto L9; else goto L7;
        }
L7: return g();
L9: return h();
}
```

  parent reply	other threads:[~2023-08-26  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03 16:01 [Bug tree-optimization/110891] New: " theodort at inf dot ethz.ch
2023-08-03 16:03 ` [Bug tree-optimization/110891] " pinskia at gcc dot gnu.org
2023-08-03 16:13 ` pinskia at gcc dot gnu.org
2023-08-04  7:59 ` rguenth at gcc dot gnu.org
2023-08-26  0:00 ` pinskia at gcc dot gnu.org [this message]
2023-08-26  0:06 ` pinskia at gcc dot gnu.org
2023-08-26  6:35 ` pinskia at gcc dot gnu.org
2023-08-26  6:35 ` pinskia at gcc dot gnu.org
2023-08-27 23:46 ` pinskia at gcc dot gnu.org
2023-08-28  6:53 ` rguenther at suse dot de
2024-03-07 23:26 ` law at gcc dot gnu.org
2024-03-09  7:01 ` law at gcc dot gnu.org
2024-05-07  7:41 ` [Bug tree-optimization/110891] [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-110891-4-L2PrMii4Wt@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).