diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-12-07 18:42:41 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-12-07 18:42:41 +0000 |
commit | 63570af0b58a3c354723bc78b75d76dbb0750f47 (patch) | |
tree | 7b1f2b8c0da2c3908d22d25dcea31ceacd492de2 /gcc/tree-ssa-ccp.c | |
parent | 44e1aae4dbd8198a26ab0ec5958e073e2c9cc772 (diff) | |
download | gcc-63570af0b58a3c354723bc78b75d76dbb0750f47.zip gcc-63570af0b58a3c354723bc78b75d76dbb0750f47.tar.gz gcc-63570af0b58a3c354723bc78b75d76dbb0750f47.tar.bz2 |
Make more use of VECTOR_CST_ENCODED_ELT
This patch makes various bits of code operate directly on the new
VECTOR_CST encoding, instead of using VECTOR_CST_ELT on all elements
of the vector.
Previous patches handled operations that produce a new VECTOR_CST,
while this patch handles things like predicates. It also makes
print_node dump the encoding instead of the full vector that
the encoding represents.
2017-12-07 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* tree-vector-builder.h
(tree_vector_builder::binary_encoded_nelts): Declare.
* tree-vector-builder.c
(tree_vector_builder::binary_encoded_nelts): New function.
* fold-const.c (negate_expr_p): Likewise.
(operand_equal_p, fold_checksum_tree): Likewise.
* tree-loop-distribution.c (const_with_all_bytes_same): Likewise.
* tree.c (integer_zerop, integer_onep, integer_all_onesp, real_zerop)
(real_onep, real_minus_onep, add_expr, initializer_zerop): Likewise.
(uniform_vector_p): Likewise.
* varasm.c (const_hash_1, compare_constant): Likewise.
* tree-ssa-ccp.c: Include tree-vector-builder.h.
(valid_lattice_transition): Operate directly on the VECTOR_CST
encoding.
* ipa-icf.c: Include tree-vector-builder.h.
(sem_variable::equals): Operate directly on the VECTOR_CST encoding.
* print-tree.c (print_node): Print encoding of VECTOR_CSTs.
From-SVN: r255480
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r-- | gcc/tree-ssa-ccp.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index ae6006d..3acddf9 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -147,6 +147,7 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-core.h" #include "stringpool.h" #include "attribs.h" +#include "tree-vector-builder.h" /* Possible lattice values. */ typedef enum @@ -465,11 +466,14 @@ valid_lattice_transition (ccp_prop_value_t old_val, ccp_prop_value_t new_val) else if (VECTOR_FLOAT_TYPE_P (type) && !HONOR_NANS (type)) { - for (unsigned i = 0; i < VECTOR_CST_NELTS (old_val.value); ++i) + unsigned int count + = tree_vector_builder::binary_encoded_nelts (old_val.value, + new_val.value); + for (unsigned int i = 0; i < count; ++i) if (!REAL_VALUE_ISNAN - (TREE_REAL_CST (VECTOR_CST_ELT (old_val.value, i))) - && !operand_equal_p (VECTOR_CST_ELT (old_val.value, i), - VECTOR_CST_ELT (new_val.value, i), 0)) + (TREE_REAL_CST (VECTOR_CST_ENCODED_ELT (old_val.value, i))) + && !operand_equal_p (VECTOR_CST_ENCODED_ELT (old_val.value, i), + VECTOR_CST_ENCODED_ELT (new_val.value, i), 0)) return false; return true; } |