From patchwork Tue Nov 15 16:43:30 2016 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: 82371 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp1809768obn; Tue, 15 Nov 2016 08:43:58 -0800 (PST) X-Received: by 10.107.129.34 with SMTP id c34mr5015400iod.31.1479228238061; Tue, 15 Nov 2016 08:43:58 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 196si16291646iou.52.2016.11.15.08.43.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Nov 2016 08:43:58 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-441504-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-441504-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-441504-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=E0uQ39qHhUmfvNcNtT6hx4UKRWbc+PldzvYG6FXrE4K7udxUWf dwoCk/9G//VH74PG6RfbOjRRekh9SWP+tPk+6JpWCIp5QFpVZah0FKHZZdfQNV2j C4n4wUg7x/hZ9FOSXffNfZuUzgkfG5KCwy6jEXjKV6iNSzsJ+gNwb03BI= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=he7wAg+3hB2lWVoLS42OEFgo08E=; b=lJki/aXc3yh9skpbWmD9 OdzlYGMl4XDwmv75C0wM5FFaAQ8lQCp5VOV/B1zMDqoKO5EsslzsepwPtGNHVwBz HIZjFJF7lfaQvs2DULIwFvrtS7KLUrmwtyoomi7Xdq7e/pIb+Sl4mllVpPa2ykMk pxvOIt66RgAEDpceWuYWu0U= Received: (qmail 2679 invoked by alias); 15 Nov 2016 16:43:44 -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 2157 invoked by uid 89); 15 Nov 2016 16:43:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Nov 2016 16:43:33 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 07C2CAAB7; Tue, 15 Nov 2016 16:43:31 +0000 (UTC) To: GCC Patches Cc: Jan Hubicka From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] Add sem_item::m_hash_set (PR ipa/78309) Message-ID: Date: Tue, 15 Nov 2016 17:43:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi. As seen on ppc64le during compilation of Firefox with LTO, combining inchash value with a pointer, enum value and an integer, one can eventually get zero value. Thus I decided to introduce a new flag that would distinguish between not set hash value and a valid and (possibly) zero value. I've been running regression tests, ready to install after it finishes? Martin >From 952ca6f6c0f99bcd965825898970453fb413964e Mon Sep 17 00:00:00 2001 From: marxin Date: Fri, 11 Nov 2016 16:15:20 +0100 Subject: [PATCH] Add sem_item::m_hash_set (PR ipa/78309) gcc/ChangeLog: 2016-11-15 Martin Liska PR ipa/78309 * ipa-icf.c (void sem_item::set_hash): Update m_hash_set. (sem_function::get_hash): Make condition based on m_hash_set. (sem_variable::get_hash): Likewise. * ipa-icf.h (sem_item::m_hash_set): New property. --- gcc/ipa-icf.c | 10 ++++++---- gcc/ipa-icf.h | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 1ab67f3..4352fd0 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -140,7 +140,8 @@ sem_usage_pair::sem_usage_pair (sem_item *_item, unsigned int _index): for bitmap memory allocation. */ sem_item::sem_item (sem_item_type _type, - bitmap_obstack *stack): type (_type), m_hash (0) + bitmap_obstack *stack): type (_type), m_hash (0), + m_hash_set (false) { setup (stack); } @@ -151,7 +152,7 @@ sem_item::sem_item (sem_item_type _type, sem_item::sem_item (sem_item_type _type, symtab_node *_node, hashval_t _hash, bitmap_obstack *stack): type(_type), - node (_node), m_hash (_hash) + node (_node), m_hash (_hash), m_hash_set (true) { decl = node->decl; setup (stack); @@ -230,6 +231,7 @@ sem_item::target_supports_symbol_aliases_p (void) void sem_item::set_hash (hashval_t hash) { m_hash = hash; + m_hash_set = true; } /* Semantic function constructor that uses STACK as bitmap memory stack. */ @@ -279,7 +281,7 @@ sem_function::get_bb_hash (const sem_bb *basic_block) hashval_t sem_function::get_hash (void) { - if (!m_hash) + if (!m_hash_set) { inchash::hash hstate; hstate.add_int (177454); /* Random number for function type. */ @@ -2116,7 +2118,7 @@ sem_variable::parse (varpool_node *node, bitmap_obstack *stack) hashval_t sem_variable::get_hash (void) { - if (m_hash) + if (m_hash_set) return m_hash; /* All WPA streamed in symbols should have their hashes computed at compile diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h index d8de655..8dc3d31 100644 --- a/gcc/ipa-icf.h +++ b/gcc/ipa-icf.h @@ -274,6 +274,9 @@ protected: /* Hash of item. */ hashval_t m_hash; + /* Indicated whether a hash value has been set or not. */ + bool m_hash_set; + private: /* Initialize internal data structures. Bitmap STACK is used for bitmap memory allocation process. */ -- 2.10.1