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 target/114902] [14/15 Regression] wrong code at -O3 with "-fno-tree-vrp -fno-expensive-optimizations -fno-tree-dominator-opts" on x86_64-linux-gnu
Date: Wed, 01 May 2024 02:06:36 +0000	[thread overview]
Message-ID: <bug-114902-4-8To5RdilCJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114902-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
            Summary|wrong code at -O3 with      |[14/15 Regression] wrong
                   |"-fno-tree-vrp              |code at -O3 with
                   |-fno-expensive-optimization |"-fno-tree-vrp
                   |s -fno-tree-dominator-opts" |-fno-expensive-optimization
                   |on x86_64-linux-gnu         |s -fno-tree-dominator-opts"
                   |                            |on x86_64-linux-gnu
          Component|tree-optimization           |target
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-05-01
     Ever confirmed|0                           |1
             Target|                            |x86_64-linux-gnu

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

Here is a testcase which does not depedent on division by zero trapping:
```

volatile int a, c;
unsigned b = 1;
int main() {
  a = 1;
  for (; c < 2; c++) {
    unsigned t = 1 & ~b;
    int e = -t;
    int f = -~(!!(1 % a));
    if (a == 0) __builtin_trap();
    if (e >= -1)
      e = 1;
    a = e;
  }
  return 0;
}
```

The testcase works on aarch64-linux-gnu with no issues.

The difference between GCC 13 and 14 is on the gimple level but the code looks
correct there.

In GCC 13 .optimized has:
```
  b.0_1 = b;
  _2 = b.0_1 & 1;
  _3 = _2 + 4294967295;
  e_16 = (int) _3;
  _13 = e_16 >= -1;
  e_11 = _13 ? 1 : e_16;
```


While in 14  .optimized has:
```
  b.0_1 = b;
  _2 = ~b.0_1;
  t_13 = _2 & 1;
  _3 = -t_13;
  e_14 = (int) _3;
  _10 = e_14 >= -1;
  e_9 = _10 ? 1 : e_14;
```

Both are valid and correct.
But then it goes wrong after that.
I have not looked where though.

  reply	other threads:[~2024-05-01  2:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 22:13 [Bug tree-optimization/114902] New: " zhendong.su at inf dot ethz.ch
2024-05-01  2:06 ` pinskia at gcc dot gnu.org [this message]
2024-05-01  2:22 ` [Bug rtl-optimization/114902] [14/15 Regression] " pinskia at gcc dot gnu.org
2024-05-01  2:34 ` pinskia at gcc dot gnu.org
2024-05-01  5:12 ` pinskia at gcc dot gnu.org
2024-05-01  5:29 ` pinskia at gcc dot gnu.org
2024-05-03  8:14 ` segher at gcc dot gnu.org
2024-05-03  8:38 ` pinskia at gcc dot gnu.org
2024-05-07  7:45 ` rguenth at gcc dot gnu.org
2024-05-09  9:48 ` segher at gcc dot gnu.org
2024-05-09  9:49 ` segher at gcc dot gnu.org
2024-05-14 20:09 ` segher at gcc dot gnu.org
2024-05-14 22:04 ` pinskia at gcc dot gnu.org
2024-05-15 16:44 ` cvs-commit at gcc dot gnu.org
2024-05-15 16:54 ` [Bug rtl-optimization/114902] [14 " jakub at gcc dot gnu.org
2024-06-04 14:26 ` cvs-commit at gcc dot gnu.org
2024-06-04 14:28 ` jakub at gcc dot gnu.org
2024-06-11  6:17 ` cvs-commit at gcc dot gnu.org
2024-06-11 10:38 ` cvs-commit at gcc dot gnu.org
2024-06-20 13:23 ` cvs-commit 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-114902-4-8To5RdilCJ@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).