Tighten tree-ssa-ccp.c:get_value_for_expr condition
commit131a1c2fd1d6260cc657c477c2dbbcfe68d8443d
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Sep 2017 11:00:43 +0000 (21 11:00 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Sep 2017 11:00:43 +0000 (21 11:00 +0000)
tree2f833fb43ecc1fb9ecb9c46f20119900d30c2630
parent09e8abb54cd2e5d47b99f1cfd41cfeb91e2d41d5
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253056 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/tree-ssa-ccp.c