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/110992] [14 Regression] Dead Code Elimination Regression at -O3 since r14-1654-g7ceed7e3e29
Date: Thu, 14 Sep 2023 21:22:25 +0000	[thread overview]
Message-ID: <bug-110992-4-dyEOfCRy1n@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110992-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
What we had before in GCC 13:
  # RANGE [irange] unsigned short [0, 1] NONZERO 0x1
  d.3_19 = (unsigned short) _3;
  _21 = -d.3_19;
  _22 = (short intD.17) _21;
  _6 = (short intD.17) b.0_1;
  _7 = _6 & _22;

Which then after  r14-1654-g7ceed7e3e29 gives us:
 _t = (short intD.17) d.3_19
 _7 = _6 * _t

What we get after that match patch:
  _3 = c.1_2 != 0;
  _25 = (short intD.17) _3;
  _22 = -_25;
  _6 = (short intD.17) b.0_1;
  _7 = _6 & _22;

That is we lose the range information.
If I add this to match.pd:
```
diff --git a/gcc/match.pd b/gcc/match.pd
index 97db0eb5f25..e68e2c57e25 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2181,6 +2181,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
       && (TYPE_UNSIGNED (type)
          || TYPE_PRECISION (type) > 1))))

+(match zero_one_valued_p
+ (convert@0 zero_one_valued_p@1))
+
 /* Transform { 0 or 1 } * { 0 or 1 } into { 0 or 1 } & { 0 or 1 }.  */
 (simplify
  (mult zero_one_valued_p@0 zero_one_valued_p@1)

```

Then this fails again.
I am thinking about adding this anyways so I am going to keep this one open.

  parent reply	other threads:[~2023-09-14 21:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11 13:24 [Bug tree-optimization/110992] New: " scherrer.sv at gmail dot com
2023-08-11 17:38 ` [Bug tree-optimization/110992] " pinskia at gcc dot gnu.org
2023-08-26  0:30 ` pinskia at gcc dot gnu.org
2023-09-14 21:11 ` pinskia at gcc dot gnu.org
2023-09-14 21:22 ` pinskia at gcc dot gnu.org [this message]
2023-09-15  3:19 ` [Bug tree-optimization/110992] [13/14 Regression] missed VRP optimization due to transformation of `a & -zero_one_valued_p` into `a * zero_one_valued_p` pinskia at gcc dot gnu.org
2023-09-15  3:54 ` pinskia at gcc dot gnu.org
2023-09-15  4:13 ` pinskia at gcc dot gnu.org
2023-09-15  4:33 ` pinskia at gcc dot gnu.org
2023-09-15 16:28 ` pinskia at gcc dot gnu.org
2023-09-15 22:45 ` pinskia at gcc dot gnu.org
2023-09-16 16:33 ` pinskia at gcc dot gnu.org
2023-09-18 23:51 ` pinskia at gcc dot gnu.org
2024-03-07 23:24 ` law at gcc dot gnu.org
2024-03-09  6:40 ` law at gcc dot gnu.org
2024-03-09  8:55 ` xry111 at gcc dot gnu.org
2024-05-21  9:16 ` [Bug tree-optimization/110992] [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-110992-4-dyEOfCRy1n@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).