public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/96674] Failure to optimize combination of comparisons to dec+compare
Date: Tue, 12 Jan 2021 23:45:39 +0000	[thread overview]
Message-ID: <bug-96674-4-Cf45PRE6Nq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96674-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
/* x < y || x == XXX_MIN --> x <= y - 1 */
(simplify
 (bit_ior (eq @1 min_value) (lt @0 @1))
  (if (INTEGRAL_TYPE_P (TREE_TYPE (@1))
       && TYPE_OVERFLOW_WRAPS (TREE_TYPE (@1)))
  (le @0 (minus @1 { build_int_cst (TREE_TYPE (@1), 1); }))))
The comment doesn't match what the simplification implements (x == XXX_MIN
should be y == XXX_MIN).
Furthermore, bit_ior is commutative and for the optimization no specific order
is needed, so probably bit_ior:c is needed.  Also, the optimization doesn't
seem to be worth if either eq or lt has multiple uses, so both should have :s
suffixes.  When x < y || y == min can be simplified into x <= y - 1, can't
its negation, i.e. x >= y && y != min be simplified into x > y - 1 ?
And agree on the noipa attribute, most of the tests you're citing just predate
the noipa attribute.  We had noinline for many years, later added noclone and
have been using noinline, noclone and when we started adding further IPA
optimizations, noipa has been added.

  parent reply	other threads:[~2021-01-12 23:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18 10:30 [Bug tree-optimization/96674] New: " gabravier at gmail dot com
2020-08-25 10:45 ` [Bug tree-optimization/96674] " rguenth at gcc dot gnu.org
2020-08-31  0:58 ` pinskia at gcc dot gnu.org
2021-01-11 22:53 ` erozen at microsoft dot com
2021-01-12 11:52 ` gabravier at gmail dot com
2021-01-12 23:12 ` erozen at microsoft dot com
2021-01-12 23:34 ` gabravier at gmail dot com
2021-01-12 23:45 ` jakub at gcc dot gnu.org [this message]
2021-01-14 21:06 ` erozen at microsoft dot com
2021-01-14 21:07 ` erozen at microsoft dot com
2021-01-14 21:30 ` ubizjak at gmail dot com
2021-01-15  0:32 ` erozen at microsoft dot com
2021-01-20 15:32 ` cvs-commit at gcc dot gnu.org
2021-06-02 18:59 ` law at gcc dot gnu.org
2021-09-17  6:44 ` 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-96674-4-Cf45PRE6Nq@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).