public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Marc Glisse <marc.glisse@inria.fr>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: VRP: x+1 and -x cannot be INT_MIN
Date: Sat, 11 Nov 2017 22:17:00 -0000	[thread overview]
Message-ID: <20171111221116.GW14653@tucnak> (raw)
In-Reply-To: <alpine.DEB.2.20.1711112244260.7206@stedding.saclay.inria.fr>

On Sat, Nov 11, 2017 at 11:03:06PM +0100, Marc Glisse wrote:
> --- gcc/tree-vrp.c	(revision 254629)
> +++ gcc/tree-vrp.c	(working copy)
> @@ -2086,20 +2086,38 @@ extract_range_from_binary_expr_1 (value_
>        else
>  	set_value_range_to_varying (vr);
>  
>        return;
>      }
>  
>    /* For integer ranges, apply the operation to each end of the
>       range and see what we end up with.  */
>    if (code == PLUS_EXPR || code == MINUS_EXPR)
>      {
> +      /* If one argument is varying, we can sometimes still deduce a
> +	 range for the output: any + [3, +INF] is in [MIN+3, +INF].  */
> +      if (TYPE_OVERFLOW_UNDEFINED (expr_type))
> +	{
> +	  if(vr0.type == VR_VARYING && vr1.type == VR_RANGE)
> +	    {
> +	      vr0.type = type = VR_RANGE;
> +	      vr0.min = vrp_val_min (expr_type);
> +	      vr0.max = vrp_val_max (expr_type);
> +	    }
> +	  if(vr1.type == VR_VARYING && vr0.type == VR_RANGE)

Missing space before ( in 2 places.
Shouldn't this second if be actually else if?

> +	    {
> +	      vr1.type = VR_RANGE;
> +	      vr1.min = vrp_val_min (expr_type);
> +	      vr1.max = vrp_val_max (expr_type);
> +	    }
> +	}
> +

	Jakub

  reply	other threads:[~2017-11-11 22:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-11 22:16 Marc Glisse
2017-11-11 22:17 ` Jakub Jelinek [this message]
2017-11-12  0:39   ` Marc Glisse
2017-11-12 21:16 ` Martin Sebor
2017-11-12 21:17   ` Marc Glisse
2017-11-13 13:40 ` Richard Biener
2017-11-19 11:02   ` Marc Glisse
2017-11-19 21:51     ` Jeff Law
2017-11-20 10:41     ` Richard Biener
2017-11-20 14:16       ` Marc Glisse
2017-11-20 15:09         ` Richard Biener

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=20171111221116.GW14653@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=marc.glisse@inria.fr \
    /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).