From patchwork Tue Nov 6 17:46:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 197527 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]) by ozlabs.org (Postfix) with SMTP id 5C3ED2C008A for ; Wed, 7 Nov 2012 04:46:58 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1352828818; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:Message-ID:Mail-Followup-To:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To: User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=PZsyICs gFhbTbWMyb/ooWEdA+NM=; b=kvQdbsisLIBT23UchYrjw3ng433jNO9ByFHKehb LwKa0aalRp14Iiv2C2pcDr7le1Ye0b79UnRDoV8ibiC4aR0WDO0beD+yzQaNV2Ca zk2MowMOoT0E86q1hYcLgZ0escNxETy6iI1arvNAsqEqJb4G7JY+DW/cgkHyrGSB OZ3k= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=A3934yqjqjRE3fMaWQR61Pqnb0ZSOUTPOGGKSFQnz/Ehoehxy+QCOSV1f8DlcF wp/nc/HJHSzhWTcm7UUcfuj9/b2bNbLiWU+LewhLnxv721/Rqoj2gbv2PFt7FJ6a QVFZLKyIAacF4HZni+/TN4iw6/4RzLt9R58IQEtzqoWQk=; Received: (qmail 24218 invoked by alias); 6 Nov 2012 17:46:50 -0000 Received: (qmail 24202 invoked by uid 22791); 6 Nov 2012 17:46:49 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Nov 2012 17:46:43 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 77CC8A24CA; Tue, 6 Nov 2012 18:46:42 +0100 (CET) Date: Tue, 6 Nov 2012 18:46:41 +0100 From: Martin Jambor To: Jan Hubicka Cc: GCC Patches Subject: Re: [PATCH] Stream cgraph_node.ipa_transforms_to_apply Message-ID: <20121106174641.GB775@virgil.arch.suse.de> Mail-Followup-To: Jan Hubicka , GCC Patches References: <20121104224353.GD5617@virgil.arch.suse.de> <20121105111550.GA11052@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20121105111550.GA11052@kam.mff.cuni.cz> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 Hi, On Mon, Nov 05, 2012 at 12:15:50PM +0100, Jan Hubicka wrote: > > Hi, > > > > the following patch adds streaming ofcgraph_node.ipa_transforms_to_apply > > so that transformation phases of IPA passes are run in LTO too. It is > > done by simple streaming of pass.static_pass_number and then looking > > it up among all_regular_ipa_passes. > > > > Bootstrapped and tested on x86_64-linux, required to make aggregate > > IPA-CP work in LTO. > > > > OK for trunk? > > > > Thanks, > > > > Martin > > > > > > 2012-11-03 Martin Jambor > > > > * lto-cgraph.c: Include tree-pass.h. > > (lto_output_node): Stream node->ipa_transforms_to_apply. > > (input_node): Likewise. > > * Makefile.in (lto-cgraph.o): Add TREE_PASS_H to dependencies. > > + count = streamer_read_hwi (ib); > > + node->ipa_transforms_to_apply = NULL; > > + for (i = 0; i < count; i++) > > + { > > + struct opt_pass *pass; > > + int pi = streamer_read_hwi (ib); > > + > > + for (pass = all_regular_ipa_passes; pass; pass = pass->next) > > + if (pass->static_pass_number == pi) > > passes.c compute vector translating IDs to pass structures, please export it and use it here; > OK with this change. > The following passes bootstrap and testsuite run on x86_64-linux. I will commit it tomorrow morning unless somebody objects. Thanks, Martin 2012-11-06 Martin Jambor * lto-cgraph.c: Include tree-pass.h. (lto_output_node): Stream node->ipa_transforms_to_apply. (input_node): Likewise. * tree-pass.h (passes_by_id): Declare. (passes_by_id_size): Likewise. * Makefile.in (lto-cgraph.o): Add TREE_PASS_H to dependencies. Index: src/gcc/lto-cgraph.c =================================================================== --- src.orig/gcc/lto-cgraph.c +++ src/gcc/lto-cgraph.c @@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. #include "data-streamer.h" #include "tree-streamer.h" #include "gcov-io.h" +#include "tree-pass.h" static void output_cgraph_opt_summary (void); static void input_cgraph_opt_summary (VEC (symtab_node, heap) * nodes); @@ -377,6 +378,8 @@ lto_output_node (struct lto_simple_outpu intptr_t ref; bool in_other_partition = false; struct cgraph_node *clone_of; + struct ipa_opt_pass_d *pass; + int i; boundary_p = !lto_symtab_encoder_in_partition_p (encoder, (symtab_node)node); @@ -432,6 +435,12 @@ lto_output_node (struct lto_simple_outpu streamer_write_hwi_stream (ob->main_stream, node->count); streamer_write_hwi_stream (ob->main_stream, node->count_materialization_scale); + streamer_write_hwi_stream (ob->main_stream, + VEC_length (ipa_opt_pass, + node->ipa_transforms_to_apply)); + FOR_EACH_VEC_ELT (ipa_opt_pass, node->ipa_transforms_to_apply, i, pass) + streamer_write_hwi_stream (ob->main_stream, pass->pass.static_pass_number); + if (tag == LTO_symtab_analyzed_node) { if (node->global.inlined_to) @@ -897,6 +906,7 @@ input_node (struct lto_file_decl_data *f int ref = LCC_NOT_FOUND, ref2 = LCC_NOT_FOUND; int clone_ref; int order; + int i, count; order = streamer_read_hwi (ib) + order_base; clone_ref = streamer_read_hwi (ib); @@ -919,6 +929,19 @@ input_node (struct lto_file_decl_data *f node->count = streamer_read_hwi (ib); node->count_materialization_scale = streamer_read_hwi (ib); + count = streamer_read_hwi (ib); + node->ipa_transforms_to_apply = NULL; + for (i = 0; i < count; i++) + { + struct opt_pass *pass; + int pid = streamer_read_hwi (ib); + + gcc_assert (pid < passes_by_id_size); + pass = passes_by_id[pid]; + VEC_safe_push (ipa_opt_pass, heap, node->ipa_transforms_to_apply, + (struct ipa_opt_pass_d *) pass); + } + if (tag == LTO_symtab_analyzed_node) ref = streamer_read_hwi (ib); Index: src/gcc/Makefile.in =================================================================== --- src.orig/gcc/Makefile.in +++ src/gcc/Makefile.in @@ -2143,7 +2143,7 @@ lto-cgraph.o: lto-cgraph.c $(CONFIG_H) $ $(HASHTAB_H) langhooks.h $(BASIC_BLOCK_H) \ $(TREE_FLOW_H) $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) $(DIAGNOSTIC_CORE_H) \ $(EXCEPT_H) $(TIMEVAR_H) pointer-set.h $(LTO_STREAMER_H) \ - $(GCOV_IO_H) $(DATA_STREAMER_H) $(TREE_STREAMER_H) + $(GCOV_IO_H) $(DATA_STREAMER_H) $(TREE_STREAMER_H) $(TREE_PASS_H) lto-streamer-in.o: lto-streamer-in.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) toplev.h $(DIAGNOSTIC_CORE_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) \ input.h $(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TREE_PASS_H) \ Index: src/gcc/tree-pass.h =================================================================== --- src.orig/gcc/tree-pass.h +++ src/gcc/tree-pass.h @@ -544,6 +544,9 @@ extern void register_pass (struct regist directly in jump threading, and avoid peeling them next time. */ extern bool first_pass_instance; +extern struct opt_pass **passes_by_id; +extern int passes_by_id_size; + /* Declare for plugins. */ extern void do_per_function_toporder (void (*) (void *), void *);