public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amacleod at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/96697] Failure to optimize mod+div to 0
Date: Mon, 04 Jan 2021 15:07:23 +0000	[thread overview]
Message-ID: <bug-96697-4-iGZJqdb2gT@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96697-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> ---
(In reply to Jakub Jelinek from comment #2)
> Shall we do that as a specific matcher or e.g. in the ranger once it gets
> code for symbolic comparisons?  I mean, for signed t = x % y note that t is
> in [-y + 1, y + 1] and on the division use that information to determine the
> division result range to be [0, 0] ?
> It could then handle even e.g. ((unsigned) x % y) / (y + 32) for signed y
> etc.

IN theory the ranger should handle this when relations are available.

    <bb 2> :
    _1 = x_2(D) % y_3(D);       // Establish relation _1 < y_3
    _4 = _1 / y_3(D);
    return _4;

IT should recognize the relation _1 < y_3 from the first statement and when we
calculate _1 / y_3, it again ought to then apply the relation and determine
that _4 = [0,0]

  parent reply	other threads:[~2021-01-04 15:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19  0:47 [Bug tree-optimization/96697] New: " gabravier at gmail dot com
2020-08-25 11:04 ` [Bug tree-optimization/96697] " rguenth at gcc dot gnu.org
2021-01-02  9:01 ` jakub at gcc dot gnu.org
2021-01-02  9:22 ` jakub at gcc dot gnu.org
2021-01-04 15:07 ` amacleod at redhat dot com [this message]
2021-07-12 19:56 ` amacleod at redhat dot com
2021-08-15 20:58 ` pinskia at gcc dot gnu.org
2021-08-15 21:33 ` 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-96697-4-iGZJqdb2gT@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).