From: hubicka Date: Fri, 16 Oct 2015 11:06:14 +0000 (+0000) Subject: Revert: X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a000165c1777e77d8f6387ce8cf93e975728c395;p=thirdparty%2Fgcc.git Revert: * ipa-icf-gimple.c (func_checker::compare_operand): Compare only empty constructors. * gcc.c-torture/compile/icfmatch.c: Add testcase git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228875 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aff6fe5fe87d..9c9cc65cb987 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-10-11 Jan Hubicka + + Revert: + * ipa-icf-gimple.c (func_checker::compare_operand): Compare only + empty constructors. + 2015-10-16 Eric Botcazou * 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 934ba9057649..4696c803617b 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 7d8b89fb19cb..3d5ad170ac93 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-10-11 Jan Hubicka + + * gcc.c-torture/compile/icfmatch.c: Add testcase + 2015-10-16 Paolo Carlini 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 000000000000..13aad2e17abb --- /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; +}