From patchwork Tue Mar 3 09:31:17 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: 445620 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 3C0481400DE for ; Tue, 3 Mar 2015 20:31:32 +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=RlAsL+Ic; 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=PCOHVzf4sogbIlKyw L8Vwg6UfaDsLugYSHUyg5Wx9ky9MpJQ7oUCD1Bs2m6pis57z4z9uR2YoUDV+ct8W LYA0bVavZN+lhwT2/OS07Etyv797UgxDPMRTmNUtcxsKFEl1r0lt3VmK0LjYnYZE GcfVv13++m0kVhctIphXpIKAx8= 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=t+YiTnnFoobaYGluE3brvmK s8Hc=; b=RlAsL+IcQED6mMNoKsFBzkwWFaW3vLzQtVnEGXFwsGh+2k/p3MD87Vx e/T5OZcCpiPHuglJNAElLLZAV1bERoZfQA7av+G6ncjtUuL/MHYyNbSKkg6ZFeuS m6xogsYac5wHvwHlwf4OPS64bsu9j1mvYrcd2sOXVBEl0h/BRdQ4= Received: (qmail 929 invoked by alias); 3 Mar 2015 09:31:24 -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 918 invoked by uid 89); 3 Mar 2015 09:31:23 -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; Tue, 03 Mar 2015 09:31:20 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8461FABA2; Tue, 3 Mar 2015 09:31:17 +0000 (UTC) Message-ID: <54F57F65.9050205@suse.cz> Date: Tue, 03 Mar 2015 10:31:17 +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 Patches , Martin Jambor Subject: Re: [PATCH] Fix PR ipa/65087 References: <54F49553.7030302@suse.cz> <20150302172004.GC67273@kam.mff.cuni.cz> In-Reply-To: <20150302172004.GC67273@kam.mff.cuni.cz> X-IsSubscribed: yes On 03/02/2015 06:20 PM, Jan Hubicka wrote: >> Hello. >> >> Following one line patch is fix for PR ipa/65087. No regression has been >> seen on x86_64-linux-pc. > > OK, it won't happend large programs, but can you arrange its execute method to > return TODO_remove_functions only if some merging actually happened? > Patch is preapproved with this change. > > Honza Yes. Attached patch is the one I've just installed, where TODO_remove_functions is returned just for cases where we merge an item. Thanks, Martin >> >> Ready for trunk? >> Thanks, >> Martin > >> >From f39be56c66387c698546c498550d38512ddeb477 Mon Sep 17 00:00:00 2001 >> From: mliska >> Date: Mon, 2 Mar 2015 16:56:42 +0100 >> Subject: [PATCH] Fix PR ipa/65087. >> >> gcc/ChangeLog: >> >> 2015-03-02 Martin Liska >> Martin Jambor >> >> PR ipa/65087 >> * ipa-icf.c: Add TODO_remove_functions to the IPA pass. >> --- >> gcc/ipa-icf.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c >> index 31fcbec..56f59a9 100644 >> --- a/gcc/ipa-icf.c >> +++ b/gcc/ipa-icf.c >> @@ -3049,7 +3049,7 @@ const pass_data pass_data_ipa_icf = >> 0, /* properties_provided */ >> 0, /* properties_destroyed */ >> 0, /* todo_flags_start */ >> - 0, /* todo_flags_finish */ >> + TODO_remove_functions, /* todo_flags_finish */ >> }; >> >> class pass_ipa_icf : public ipa_opt_pass_d >> -- >> 2.1.2 >> > From 3a3bc6bda4ab1c47e8fa74e9a46cbd7abe612cc1 Mon Sep 17 00:00:00 2001 From: mliska Date: Mon, 2 Mar 2015 16:56:42 +0100 Subject: [PATCH] Fix PR ipa/65087. gcc/ChangeLog: 2015-03-02 Martin Liska Martin Jambor PR ipa/65087 * ipa-icf.c (sem_item_optimizer::execute): Change function return value to boolean. (sem_item_optimizer::merge_classes): Likewise. (ipa_icf_driver): Return TODO_remove_functions in case there's a merge operation processed. * ipa-icf.h: Change function return value to boolean. --- gcc/ipa-icf.c | 26 ++++++++++++++++++-------- gcc/ipa-icf.h | 11 +++++++---- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 31fcbec..9cdd73e 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -2167,9 +2167,11 @@ sem_item_optimizer::filter_removed_items (void) m_items.safe_push (filtered[i]); } -/* Optimizer entry point. */ +/* Optimizer entry point which returns true in case it processes + a merge operation. True is returned if there's a merge operation + processed. */ -void +bool sem_item_optimizer::execute (void) { filter_removed_items (); @@ -2214,10 +2216,12 @@ sem_item_optimizer::execute (void) process_cong_reduction (); dump_cong_classes (); verify_classes (); - merge_classes (prev_class_count); + bool merged_p = merge_classes (prev_class_count); if (dump_file && (dump_flags & TDF_DETAILS)) symtab_node::dump_table (dump_file); + + return merged_p; } /* Function responsible for visiting all potential functions and @@ -2870,9 +2874,10 @@ sem_item_optimizer::dump_cong_classes (void) /* After reduction is done, we can declare all items in a group to be equal. PREV_CLASS_COUNT is start number of classes - before reduction. */ + before reduction. True is returned if there's a merge operation + processed. */ -void +bool sem_item_optimizer::merge_classes (unsigned int prev_class_count) { unsigned int item_count = m_items.length (); @@ -2882,6 +2887,8 @@ sem_item_optimizer::merge_classes (unsigned int prev_class_count) unsigned int non_singular_classes_count = 0; unsigned int non_singular_classes_sum = 0; + bool merged_p = false; + for (hash_table::iterator it = m_classes.begin (); it != m_classes.end (); ++it) for (unsigned int i = 0; i < (*it)->classes.length (); i++) @@ -2952,9 +2959,12 @@ sem_item_optimizer::merge_classes (unsigned int prev_class_count) alias->dump_to_file (dump_file); } - source->merge (alias); + if (source->merge (alias)) + merged_p = true; } } + + return merged_p; } /* Dump function prints all class members to a FILE with an INDENT. */ @@ -3031,12 +3041,12 @@ ipa_icf_driver (void) { gcc_assert (optimizer); - optimizer->execute (); + bool merged_p = optimizer->execute (); delete optimizer; optimizer = NULL; - return 0; + return merged_p ? TODO_remove_functions : 0; } const pass_data pass_data_ipa_icf = diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h index e3582db..1481353 100644 --- a/gcc/ipa-icf.h +++ b/gcc/ipa-icf.h @@ -470,8 +470,10 @@ public: read-only variables that can be merged. */ void parse_funcs_and_vars (void); - /* Optimizer entry point. */ - void execute (void); + /* Optimizer entry point which returns true in case it processes + a merge operation. True is returned if there's a merge operation + processed. */ + bool execute (void); /* Dump function. */ void dump (void); @@ -545,8 +547,9 @@ private: /* After reduction is done, we can declare all items in a group to be equal. PREV_CLASS_COUNT is start number of classes - before reduction. */ - void merge_classes (unsigned int prev_class_count); + before reduction. True is returned if there's a merge operation + processed. */ + bool merge_classes (unsigned int prev_class_count); /* Adds a newly created congruence class CLS to worklist. */ void worklist_push (congruence_class *cls); -- 2.1.2