diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2015-10-16 13:06:14 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2015-10-16 11:06:14 +0000 |
commit | 6d244704f731efd9c4590ac6697aad4b733f97b1 (patch) | |
tree | 4f5c15c33de7664bca1119c3bf2def546cfdd1a5 /gcc | |
parent | 535a86378ea5182125321ceede077e3781973f0a (diff) | |
download | gcc-6d244704f731efd9c4590ac6697aad4b733f97b1.zip gcc-6d244704f731efd9c4590ac6697aad4b733f97b1.tar.gz gcc-6d244704f731efd9c4590ac6697aad4b733f97b1.tar.bz2 |
revert: ipa-icf-gimple.c (func_checker::compare_operand): Compare only empty constructors.
Revert:
* ipa-icf-gimple.c (func_checker::compare_operand): Compare only
empty constructors.
* gcc.c-torture/compile/icfmatch.c: Add testcase
From-SVN: r228875
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ipa-icf-gimple.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/icfmatch.c | 11 |
4 files changed, 35 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aff6fe5..9c9cc65 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-10-11 Jan Hubicka <hubicka@ucw.cz> + + Revert: + * ipa-icf-gimple.c (func_checker::compare_operand): Compare only + empty constructors. + 2015-10-16 Eric Botcazou <ebotcazou@adacore.com> * tree.c (recompute_tree_invariant_for_addr_expr): Assert that the diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index 934ba90..4696c80 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -415,9 +415,20 @@ func_checker::compare_operand (tree t1, tree t2) switch (TREE_CODE (t1)) { case CONSTRUCTOR: - gcc_assert (!vec_safe_length (CONSTRUCTOR_ELTS (t1)) - && !vec_safe_length (CONSTRUCTOR_ELTS (t2))); - return true; + { + unsigned length1 = vec_safe_length (CONSTRUCTOR_ELTS (t1)); + unsigned length2 = vec_safe_length (CONSTRUCTOR_ELTS (t2)); + + if (length1 != length2) + return return_false (); + + for (unsigned i = 0; i < length1; i++) + if (!compare_operand (CONSTRUCTOR_ELT (t1, i)->value, + CONSTRUCTOR_ELT (t2, i)->value)) + return return_false(); + + return true; + } case ARRAY_REF: case ARRAY_RANGE_REF: /* First argument is the array, second is the index. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7d8b89f..3d5ad17 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-10-11 Jan Hubicka <hubicka@ucw.cz> + + * gcc.c-torture/compile/icfmatch.c: Add testcase + 2015-10-16 Paolo Carlini <paolo.carlini@oracle.com> PR c++/67926 diff --git a/gcc/testsuite/gcc.c-torture/compile/icfmatch.c b/gcc/testsuite/gcc.c-torture/compile/icfmatch.c new file mode 100644 index 0000000..13aad2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/icfmatch.c @@ -0,0 +1,11 @@ +typedef char __attribute__ ((vector_size (4))) v4qi; +void retv (int a,int b,int c,int d, v4qi *ret) +{ + v4qi v = { a, b , c, d }; + *ret = v; +} +void retv2 (int a,int b,int c,int d, v4qi *ret) +{ + v4qi v = { a, b , c, d }; + *ret = v; +} |