From 6d244704f731efd9c4590ac6697aad4b733f97b1 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 16 Oct 2015 13:06:14 +0200 Subject: [PATCH] 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 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-icf-gimple.c | 17 ++++++++++++++--- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.c-torture/compile/icfmatch.c | 11 +++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/icfmatch.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aff6fe5fe87..9c9cc65cb98 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 934ba905764..4696c803617 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 7d8b89fb19c..3d5ad170ac9 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 00000000000..13aad2e17ab --- /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; +} -- 2.30.2