diff mbox series

Protect second call to extract_range_from_multiplicative_op_1

Message ID 87efn6hr19.fsf@linaro.org
State New
Headers show
Series Protect second call to extract_range_from_multiplicative_op_1 | expand

Commit Message

Richard Sandiford Jan. 4, 2018, 10:11 a.m. UTC
Following on from:

        * tree-vrp.c (extract_range_from_multiplicative_op_1): Assert
        for VR_RANGE only; don't allow VR_ANTI_RANGE.
        (extract_range_from_binary_expr_1): Don't call
        extract_range_from_multiplicative_op_1 if !range_int_cst_p.

there was a later call to extract_range_from_multiplicative_op_1 too,
that used a negative test for a symbolic (!is_gimple_min_invariant)
range rather than a positive test for an integer range.

Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.
Also tested by comparing the before and after assembly output for at
least one target per CPU directory.  OK to install?

Richard


2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	* tree-vrp.c (extract_range_from_binary_expr_1): Check
	range_int_cst_p rather than !symbolic_range_p before calling
	extract_range_from_multiplicative_op_1.

Comments

Jeff Law Jan. 4, 2018, 6:34 p.m. UTC | #1
On 01/04/2018 03:11 AM, Richard Sandiford wrote:
> Following on from:

> 

>         * tree-vrp.c (extract_range_from_multiplicative_op_1): Assert

>         for VR_RANGE only; don't allow VR_ANTI_RANGE.

>         (extract_range_from_binary_expr_1): Don't call

>         extract_range_from_multiplicative_op_1 if !range_int_cst_p.

> 

> there was a later call to extract_range_from_multiplicative_op_1 too,

> that used a negative test for a symbolic (!is_gimple_min_invariant)

> range rather than a positive test for an integer range.

> 

> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.

> Also tested by comparing the before and after assembly output for at

> least one target per CPU directory.  OK to install?

> 

> Richard

> 

> 

> 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>

> 

> gcc/

> 	* tree-vrp.c (extract_range_from_binary_expr_1): Check

> 	range_int_cst_p rather than !symbolic_range_p before calling

> 	extract_range_from_multiplicative_op_1.

OK.
jeff
diff mbox series

Patch

Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c	2018-01-03 11:12:55.826759160 +0000
+++ gcc/tree-vrp.c	2018-01-04 10:09:44.701136182 +0000
@@ -2042,7 +2042,7 @@  extract_range_from_binary_expr_1 (value_
 	      return;
 	    }
 	}
-      else if (!symbolic_range_p (&vr0) && !symbolic_range_p (&vr1))
+      else if (range_int_cst_p (&vr0) && range_int_cst_p (&vr1))
 	{
 	  extract_range_from_multiplicative_op_1 (vr, code, &vr0, &vr1);
 	  return;