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/110539] [14 Regression] Dead Code Elimination Regression at since r14-338-g1dd154f6407
Date: Thu, 06 Jul 2023 21:41:11 +0000	[thread overview]
Message-ID: <bug-110539-4-bIVMLnGPqe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110539-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the difference comes from the order. Before in phiopt we had:
-  /* Defer boolean x ? 0 : {1,-1} or x ? {1,-1} : 0 to
-     match_simplify_replacement.  */
-  if (TREE_CODE (TREE_TYPE (lhs)) == BOOLEAN_TYPE
-      && (integer_zerop (arg0)
-         || integer_zerop (arg1)
-         || TREE_CODE (TREE_TYPE (arg0)) == BOOLEAN_TYPE
-         || (TYPE_PRECISION (TREE_TYPE (arg0))
-             <= TYPE_PRECISION (TREE_TYPE (lhs)))))
-    return false;

But now the order is such that `?0:{1,-1}`, `?{1,-1}:0` is handled first.

So what we need to pattern match here is `(convert)zero_one_value_p@0!=0` and
simplify that into just (convert)@0

(for neeq (ne eq)
 (simplify
  (convert (neeq zero_one_value_p@0 integer_zerop))
  (if (neeq == NE_EXPR))
   (convert @0)
   (bit_xor (convert @0) { build_one_cst (type); } ))

  parent reply	other threads:[~2023-07-06 21:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-04  9:38 [Bug tree-optimization/110539] New: " theodort at inf dot ethz.ch
2023-07-05  6:44 ` [Bug tree-optimization/110539] " rguenth at gcc dot gnu.org
2023-07-06 21:20 ` pinskia at gcc dot gnu.org
2023-07-06 21:41 ` pinskia at gcc dot gnu.org [this message]
2023-07-06 21:45 ` pinskia at gcc dot gnu.org
2023-07-06 22:03 ` pinskia at gcc dot gnu.org
2023-07-06 22:44 ` pinskia at gcc dot gnu.org
2023-07-08  0:33 ` pinskia at gcc dot gnu.org
2023-07-11 23:13 ` pinskia at gcc dot gnu.org
2023-07-12  7:18 ` pinskia at gcc dot gnu.org
2023-07-12 17:32 ` pinskia at gcc dot gnu.org
2023-07-13 14:55 ` cvs-commit at gcc dot gnu.org
2023-07-13 14:55 ` pinskia 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-110539-4-bIVMLnGPqe@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).