public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marc Glisse <marc.glisse@inria.fr>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] match.pd: Use ranges to optimize some x * y / y to x [PR97997]
Date: Sun, 6 Dec 2020 10:44:55 +0100 (CET)	[thread overview]
Message-ID: <1592e468-1b41-83b6-3e87-885a47aaacc4@stedding.saclay.inria.fr> (raw)
In-Reply-To: <20201126085205.GR3788@tucnak>

On Thu, 26 Nov 2020, Jakub Jelinek via Gcc-patches wrote:

> For signed integers with undefined overflow we already optimize x * y / y
> into x, but for signed integers with -fwrapv or unsigned integers we don't.
> The following patch allows optimizing that into just x if value ranges
> prove that x * y will never overflow.

I've long wanted a helper that checks if VRP thinks an operation could 
overflow, I think at some point it would make sense to move this code to 
some function so that it can be easily reused. Maybe also define a matcher 
so we can write (mult_noovf @0 @1) which would succeed if either overflow 
is undefined or if VRP can prove that no overflow is happening.

Of course that's all ideas for later, refactoring belongs in the second or 
third patch using a feature, not the first one :-)

-- 
Marc Glisse

      parent reply	other threads:[~2020-12-06  9:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26  8:52 Jakub Jelinek
2020-11-26  9:24 ` Richard Biener
2020-11-26  9:36   ` Jakub Jelinek
2020-11-26 13:36     ` Richard Biener
2020-11-30 15:28 ` Andrew MacLeod
2020-12-06  9:44 ` Marc Glisse [this message]

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=1592e468-1b41-83b6-3e87-885a47aaacc4@stedding.saclay.inria.fr \
    --to=marc.glisse@inria.fr \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    /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).