summaryrefslogtreecommitdiff
path: root/gcc/ipa-icf.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-12-07 18:42:41 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-12-07 18:42:41 +0000
commit63570af0b58a3c354723bc78b75d76dbb0750f47 (patch)
tree7b1f2b8c0da2c3908d22d25dcea31ceacd492de2 /gcc/ipa-icf.c
parent44e1aae4dbd8198a26ab0ec5958e073e2c9cc772 (diff)
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/ipa-icf.c')
-rw-r--r--gcc/ipa-icf.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 3f6f432483b..a8d3b800318 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -83,6 +83,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-icf.h"
#include "stor-layout.h"
#include "dbgcnt.h"
+#include "tree-vector-builder.h"
using namespace ipa_icf_gimple;
@@ -2024,17 +2025,17 @@ sem_variable::equals (tree t1, tree t2)
&TREE_REAL_CST (t2)));
case VECTOR_CST:
{
- unsigned i;
-
if (VECTOR_CST_NELTS (t1) != VECTOR_CST_NELTS (t2))
return return_false_with_msg ("VECTOR_CST nelts mismatch");
- for (i = 0; i < VECTOR_CST_NELTS (t1); ++i)
- if (!sem_variable::equals (VECTOR_CST_ELT (t1, i),
- VECTOR_CST_ELT (t2, i)))
- return 0;
+ unsigned int count
+ = tree_vector_builder::binary_encoded_nelts (t1, t2);
+ for (unsigned int i = 0; i < count; ++i)
+ if (!sem_variable::equals (VECTOR_CST_ENCODED_ELT (t1, i),
+ VECTOR_CST_ENCODED_ELT (t2, i)))
+ return false;
- return 1;
+ return true;
}
case ARRAY_REF:
case ARRAY_RANGE_REF: