From: Martin Liska Date: Sun, 1 Mar 2015 00:13:10 +0000 (+0100) Subject: ICF is more strict about non-common function and var X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e8fb91a8499ab23527737fe5fa9d72478e3d93b2;p=gcc.git ICF is more strict about non-common function and var * ipa-icf-gimple.c (func_checker::compare_variable_decl): Validate variable alignment. * ipa-icf.c (sem_function::equals_private): Be more precise about non-common function attributes. (sem_variable::equals): Likewise. * gcc.target/i386/stackalign/longlong-2.c: Omit ICF. * g++.dg/ipa/pr63595.C: Update expected results. From-SVN: r221080 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4c45c2e7264..5d792b1dc2b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2015-03-01 Martin Liska + + Jan Hubicka + + * ipa-icf-gimple.c (func_checker::compare_variable_decl): + Validate variable alignment. + * ipa-icf.c (sem_function::equals_private): Be more precise + about non-common function attributes. + (sem_variable::equals): Likewise. + 2015-02-28 Jan Hubicka PR ipa/65237 diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index 53d2c38bc9f..cbeb7952ca1 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -575,6 +575,9 @@ func_checker::compare_variable_decl (tree t1, tree t2) if (t1 == t2) return true; + if (DECL_ALIGN (t1) != DECL_ALIGN (t2)) + return return_false_with_msg ("alignments are different"); + if (DECL_HARD_REGISTER (t1) != DECL_HARD_REGISTER (t2)) return return_false_with_msg ("DECL_HARD_REGISTER are different"); diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index d66d4c8c07b..6db5c084ad5 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -619,6 +619,30 @@ sem_function::equals_private (sem_item *item, if (!compare_phi_node (bb_sorted[i]->bb, m_compared_func->bb_sorted[i]->bb)) return return_false_with_msg ("PHI node comparison returns false"); + /* Compare special function DECL attributes. */ + if (DECL_FUNCTION_PERSONALITY (decl) != DECL_FUNCTION_PERSONALITY (item->decl)) + return return_false_with_msg ("function personalities are different"); + + if (DECL_DISREGARD_INLINE_LIMITS (decl) != DECL_DISREGARD_INLINE_LIMITS (item->decl)) + return return_false_with_msg ("DECL_DISREGARD_INLINE_LIMITS are different"); + + if (DECL_DECLARED_INLINE_P (decl) != DECL_DECLARED_INLINE_P (item->decl)) + return return_false_with_msg ("inline attributes are different"); + + if (DECL_IS_OPERATOR_NEW (decl) != DECL_IS_OPERATOR_NEW (item->decl)) + return return_false_with_msg ("operator new flags are different"); + + if (DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (decl) + != DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (item->decl)) + return return_false_with_msg ("intrument function entry exit " + "attributes are different"); + + if (DECL_NO_LIMIT_STACK (decl) != DECL_NO_LIMIT_STACK (item->decl)) + return return_false_with_msg ("no stack limit attributes are different"); + + if (flags_from_decl_or_type (decl) != flags_from_decl_or_type (item->decl)) + return return_false_with_msg ("decl_or_type flags are different"); + return result; } @@ -1298,6 +1322,17 @@ sem_variable::equals (sem_item *item, if (!ctor || !v->ctor) return return_false_with_msg ("ctor is missing for semantic variable"); + if (DECL_IN_CONSTANT_POOL (decl) + && (DECL_IN_CONSTANT_POOL (item->decl) + || item->node->address_matters_p ())) + return return_false_with_msg ("constant pool"); + + if (DECL_IN_TEXT_SECTION (decl) != DECL_IN_TEXT_SECTION (item->decl)) + return return_false_with_msg ("text section"); + + if (DECL_TLS_MODEL (decl) || DECL_TLS_MODEL (item->decl)) + return return_false_with_msg ("TLS model"); + return sem_variable::equals (ctor, v->ctor); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf0978e957f..0ec2c0cb9b8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-03-01 Martin Liska + + * gcc.target/i386/stackalign/longlong-2.c: Omit ICF. + * g++.dg/ipa/pr63595.C: Update expected results. + 2015-02-28 Jan Hubicka PR ipa/65236 diff --git a/gcc/testsuite/g++.dg/ipa/pr63595.C b/gcc/testsuite/g++.dg/ipa/pr63595.C index 30e930345b5..48ba4193b71 100644 --- a/gcc/testsuite/g++.dg/ipa/pr63595.C +++ b/gcc/testsuite/g++.dg/ipa/pr63595.C @@ -76,5 +76,5 @@ int main() return 0; } -/* { dg-final { scan-ipa-dump "Equal symbols: 1" "icf" } } */ +/* { dg-final { scan-ipa-dump "Equal symbols: 0" "icf" } } */ /* { dg-final { cleanup-ipa-dump "icf" } } */ diff --git a/gcc/testsuite/gcc.target/i386/stackalign/longlong-2.c b/gcc/testsuite/gcc.target/i386/stackalign/longlong-2.c index 6ea83f98fb5..d52b9d15f64 100644 --- a/gcc/testsuite/gcc.target/i386/stackalign/longlong-2.c +++ b/gcc/testsuite/gcc.target/i386/stackalign/longlong-2.c @@ -1,6 +1,6 @@ /* { dg-do compile { target { ! *-*-darwin* } } } */ /* { dg-require-effective-target ia32 } */ -/* { dg-options "-O2 -mpreferred-stack-boundary=2" } */ +/* { dg-options "-O2 -mpreferred-stack-boundary=2 -fno-ipa-icf" } */ /* { dg-final { scan-assembler-times "and\[lq\]?\[^\\n\]*-8,\[^\\n\]*sp" 2 } } */ /* { dg-final { scan-assembler-times "and\[lq\]?\[^\\n\]*-16,\[^\\n\]*sp" 2 } } */