diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-09-21 11:00:43 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-09-21 11:00:43 +0000 |
commit | 4a77e8874709d7848e4216c59089ccce756f228e (patch) | |
tree | 2f833fb43ecc1fb9ecb9c46f20119900d30c2630 /gcc | |
parent | dd72b5f95275ca75dc54b8b51a14ff2025ed1a3a (diff) | |
download | gcc-4a77e8874709d7848e4216c59089ccce756f228e.zip gcc-4a77e8874709d7848e4216c59089ccce756f228e.tar.gz gcc-4a77e8874709d7848e4216c59089ccce756f228e.tar.bz2 |
Tighten tree-ssa-ccp.c:get_value_for_expr condition
bit_value_unop and bit_value_binop require constant values
to be INTEGER_CSTs:
gcc_assert ((rval.lattice_val == CONSTANT
&& TREE_CODE (rval.value) == INTEGER_CST)
|| wi::sext (rval.mask, TYPE_PRECISION (TREE_TYPE (rhs))) == -1);
However, when deciding whether to record a constant value,
the for_bits_p handling in get_value_for_expr used a negative
test for ADDR_EXPR:
else if (is_gimple_min_invariant (expr)
&& (!for_bits_p || TREE_CODE (expr) != ADDR_EXPR))
This patch uses a positive test for INTEGER_CST instead.
Existing tests showed the need for this once polynomial constants
are added.
2017-09-21 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* tree-ssa-ccp.c (get_value_for_expr): Use a positive test for
INTEGER_CST rather than a negative test for ADDR_EXPR.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r253056
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/tree-ssa-ccp.c | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3861e66..6f2f3d7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -2,6 +2,13 @@ Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> + * tree-ssa-ccp.c (get_value_for_expr): Use a positive test for + INTEGER_CST rather than a negative test for ADDR_EXPR. + +2017-09-21 Richard Sandiford <richard.sandiford@linaro.org> + Alan Hayward <alan.hayward@arm.com> + David Sherwood <david.sherwood@arm.com> + * tree-vrp.c (extract_range_from_binary_expr_1): Check int_cst_rangeN before calling value_range_constant_singleton (&vrN). diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 3940d53..9811640 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -617,7 +617,7 @@ get_value_for_expr (tree expr, bool for_bits_p) } } else if (is_gimple_min_invariant (expr) - && (!for_bits_p || TREE_CODE (expr) != ADDR_EXPR)) + && (!for_bits_p || TREE_CODE (expr) == INTEGER_CST)) { val.lattice_val = CONSTANT; val.value = expr; |