From patchwork Sat Feb 28 23:54:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 444683 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E300F1400F1 for ; Sun, 1 Mar 2015 10:55:07 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=HrNIrUzP; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=YHDyEBRtlcY3gT/44 TZNbb9wU67bE9iY2Br7gAyoEQbyVTz96O+bQJwWETySIoNSE6+dAjtRwUOhfeNWG QyD3gKs530LYjadsaH+2O/nBTsgj82y00gBzD+QoDi4Wk3Kw3FFuEMCcWmTJKArQ poICx6s5N1GY+B4IAX8UdwQLh4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=wqPQSocYJxpzZknkLkRAFE1 GAV8=; b=HrNIrUzPaGiC/qaTe48nUFWUJ6bzgdsH/cknxELGnNvck0oGygVfN3A pHUfJKTUoFsWOrCaIqQ8zkn0bbrXE2iRggh7orfGHGMr2i/522ocmkIdJUIwbkXS u7Pu9K+fWacDZv/DWGbuwD8zcJgvh+NTerjgSL6rbrTrOm74svW4= Received: (qmail 9915 invoked by alias); 28 Feb 2015 23:54:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 9903 invoked by uid 89); 28 Feb 2015 23:54:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Sat, 28 Feb 2015 23:54:57 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B672DABEE; Sat, 28 Feb 2015 23:54:53 +0000 (UTC) Message-ID: <54F2554D.5080109@suse.cz> Date: Sun, 01 Mar 2015 00:54:53 +0100 From: =?windows-1252?Q?Martin_Li=9Aka?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Jan Hubicka CC: "gcc-pat >> GCC Patches" Subject: Re: [PATCH] ICF is more strict about non-common function and var, attributes. References: <54F23BFA.4060502@suse.cz> <20150228224223.GD20437@kam.mff.cuni.cz> In-Reply-To: <20150228224223.GD20437@kam.mff.cuni.cz> X-IsSubscribed: yes On 02/28/2015 11:42 PM, Jan Hubicka wrote: >> >> 2015-02-28 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. > OK, > does this fix > gcc.target/i386/stackalign/longlong-2.c -mno-stackrealign scan-assembler-times and[lq]?[^\\n]*-16,[^\\n]*sp 2 > FAIL: gcc.target/i386/stackalign/longlong-2.c -mno-stackrealign scan-assembler-times and[lq]?[^\\n]*-8,[^\\n]*sp 2 > FAIL: gcc.target/i386/stackalign/longlong-2.c -mstackrealign scan-assembler-times and[lq]?[^\\n]*-16,[^\\n]*sp 2 > FAIL: gcc.target/i386/stackalign/longlong-2.c -mstackrealign scan-assembler-times and[lq]?[^\\n]*-8,[^\\n]*sp 2 > > on -m32 mentioned in PR65237? > > Honza >> >> > Half of FAILs are gone, but the rest is correctly merged (alignment matches). Thus I would omit ICF in this testcase. I'm going to install the patch. Thanks, Martin From 60c5fdc5d5bab2d26a43813ffebda247c8dd1fce Mon Sep 17 00:00:00 2001 From: mliska Date: Fri, 27 Feb 2015 21:49:46 +0100 Subject: [PATCH 1/4] ICF is more strict about non-common function and var attributes. gcc/ChangeLog: 2015-02-28 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. gcc/testsuite/ChangeLog: 2015-03-01 Martin Liska Jan Hubicka * gcc.target/i386/stackalign/longlong-2.c: Omit ICF. --- gcc/ipa-icf-gimple.c | 3 ++ gcc/ipa-icf.c | 35 ++++++++++++++++++++++ .../gcc.target/i386/stackalign/longlong-2.c | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index 53d2c38..cbeb795 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 5d50b6f..92133fc 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; } @@ -1280,6 +1304,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/gcc.target/i386/stackalign/longlong-2.c b/gcc/testsuite/gcc.target/i386/stackalign/longlong-2.c index 6ea83f9..d52b9d1 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 } } */ -- 2.1.2