From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13076 invoked by alias); 17 Oct 2014 13:36:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 13060 invoked by uid 89); 17 Oct 2014 13:36:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients 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; Fri, 17 Oct 2014 13:36:40 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D9FFEABE6; Fri, 17 Oct 2014 13:36:36 +0000 (UTC) Message-ID: <54411B64.1060908@suse.cz> Date: Fri, 17 Oct 2014 13:45:00 -0000 From: =?UTF-8?B?TWFydGluIExpxaFrYQ==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: "gcc-pa >> GCC Patches" CC: pinskia@gcc.gnu.org, "hubicka >> Jan Hubicka" Subject: [PATCH] Fix for PR63569 Content-Type: multipart/mixed; boundary="------------030209020606010608030107" X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg01724.txt.bz2 This is a multi-part message in MIME format. --------------030209020606010608030107 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 153 Hello. Following patch fixes PR63569. Bootstrap executed on ppc64-linux and no regression seen on x86_64-pc-linux. Ready for trunk? Thank you, Martin --------------030209020606010608030107 Content-Type: text/plain; charset=UTF-8; name="ipa-icf-volatility.changelog" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="ipa-icf-volatility.changelog" Content-length: 525 Z2NjL3Rlc3RzdWl0ZS9DaGFuZ2VMb2c6CgoyMDE0LTEwLTE3ICBNYXJ0aW4g TGlza2EgIDxtbGlza2FAc3VzZS5jej4KCgkqIGdjYy5kZy9pcGEvaXBhLWlj Zi0zMS5jOiBOZXcgdGVzdC4KCgpnY2MvQ2hhbmdlTG9nOgoKMjAxNC0xMC0x NyAgTWFydGluIExpc2thICA8bWxpc2thQHN1c2UuY3o+CgoJKiBpcGEtaWNm LWdpbXBsZS5jIChmdW5jX2NoZWNrZXI6OmNvbXBhcmVfdm9sYXRpbGl0eSk6 IE5ldyBmdW5jdGlvbi4KCShmdW5jX2NoZWNrZXI6OmNvbXBhcmVfZ2ltcGxl X2NhbGwpOiBWb2xhdGlsaXR5IGNoZWNrIGFkZGVkLgoJKGZ1bmNfY2hlY2tl cjo6Y29tcGFyZV9naW1wbGVfYXNzaWduKTogTGlrZXdpc2UuCgkqIGlwYS1p Y2YtZ2ltcGxlLmg6IE5ldyBmdW5jdGlvbi4K --------------030209020606010608030107 Content-Type: text/x-patch; name="ipa-icf-volatility.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ipa-icf-volatility.patch" Content-length: 2715 diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index 792a3e4..1b9ee85 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -452,6 +452,17 @@ func_checker::compare_tree_list_operand (tree t1, tree t2) return true; } +/* Compares if both trees T1 and T2 have equal volatility. */ + +bool +func_checker::compare_volatility (tree t1, tree t2) +{ + if (t1 && t2) + return TREE_THIS_VOLATILE (t1) == TREE_THIS_VOLATILE (t2); + + return !(t1 || t2); +} + /* Verifies that trees T1 and T2, representing function declarations are equivalent from perspective of ICF. */ @@ -663,6 +674,9 @@ func_checker::compare_gimple_call (gimple s1, gimple s2) t1 = gimple_get_lhs (s1); t2 = gimple_get_lhs (s2); + if (!compare_volatility (t1, t2)) + return return_false_with_msg ("different volatility for call statement"); + return compare_operand (t1, t2); } @@ -696,8 +710,11 @@ func_checker::compare_gimple_assign (gimple s1, gimple s2) if (!compare_operand (arg1, arg2)) return false; - } + if (!compare_volatility (arg1, arg2)) + return return_false_with_msg ("different volatility for assignment " + "statement"); + } return true; } diff --git a/gcc/ipa-icf-gimple.h b/gcc/ipa-icf-gimple.h index 8487a2a..b791c21 100644 --- a/gcc/ipa-icf-gimple.h +++ b/gcc/ipa-icf-gimple.h @@ -209,6 +209,10 @@ public: two trees are semantically equivalent. */ bool compare_tree_list_operand (tree t1, tree t2); + /* Compares two tree list operands T1 and T2 and returns true if these + two trees are semantically equivalent. */ + bool compare_volatility (tree t1, tree t2); + /* Verifies that trees T1 and T2, representing function declarations are equivalent from perspective of ICF. */ bool compare_function_decl (tree t1, tree t2); diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-icf-31.c b/gcc/testsuite/gcc.dg/ipa/ipa-icf-31.c new file mode 100644 index 0000000..e70d72d --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/ipa-icf-31.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-fipa-icf -fdump-ipa-icf-details" } */ + + +static int f(int t, int *a) __attribute__((noinline)); + +static int g(int t, volatile int *a) __attribute__((noinline)); +static int g(int t, volatile int *a) +{ + int i; + int tt = 0; + for(i=0;i