From patchwork Tue Jul 31 23:21:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 174351 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 D26092C0084 for ; Wed, 1 Aug 2012 09:22:08 +1000 (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=1344381729; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=7eLZnStxENfzgo11ht9Ftl9mBnI=; b=ihRwqarMKUkt9xutw73gAMUMkwksdk67z6Twdg11GupjfO9quqKofjpm5tcAnn cXQbjJZp2l0iYjExyF9MiOjweGsZ2UfEs0ISwJsD38qq2X3K+msnY47wfIebN4Fu jPqHon+z8xGbYeqCqFPGjklWPOkTJZVj1VR4B9LroPnSU= 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:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=e1YYGHhnAEglbUVAEKh4Yz0f70+8/tli+sscxKG71uIztgcd9im/1ARumqefcB 0fdJcIzlB9knLJzl9aS+dZxVdSclPlY5U9uzfQ851kWcQiFreIlyIhlgJqJuK6ax V7ty60k4akncP8UVEqkKh2zM2WJf+0GaPT39vLO5EXk3c=; Received: (qmail 13483 invoked by alias); 31 Jul 2012 23:22:06 -0000 Received: (qmail 13473 invoked by uid 22791); 31 Jul 2012 23:22:04 -0000 X-SWARE-Spam-Status: No, hits=-5.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-vc0-f175.google.com (HELO mail-vc0-f175.google.com) (209.85.220.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 31 Jul 2012 23:21:51 +0000 Received: by vcbfy27 with SMTP id fy27so6608693vcb.20 for ; Tue, 31 Jul 2012 16:21:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.59.7.138 with SMTP id dc10mr4006566ved.8.1343776910794; Tue, 31 Jul 2012 16:21:50 -0700 (PDT) Received: by 10.58.179.79 with HTTP; Tue, 31 Jul 2012 16:21:50 -0700 (PDT) In-Reply-To: <20120731123923.GA14617@atrey.karlin.mff.cuni.cz> References: <20120707040814.GA23165@intel.com> <20120731123923.GA14617@atrey.karlin.mff.cuni.cz> Date: Tue, 31 Jul 2012 16:21:50 -0700 Message-ID: Subject: Re: PR middle-end/53321: [4.8 Regression] LTO bootstrap failed with bootstrap-profiled From: "H.J. Lu" To: Jan Hubicka Cc: gcc-patches@gcc.gnu.org, Jan Hubicka 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 On Tue, Jul 31, 2012 at 5:39 AM, Jan Hubicka wrote: >> Hi, >> >> 2012-07-06 H.J. Lu >> >> PR middle-end/53321 >> PR middle-end/53865 >> * Makefile.in (tree-profile.o): Depend on ipa-inline.h. >> >> * ipa.c (symtab_remove_unreachable_nodes): Restore >> cgraph_propagate_frequency call when something was changed. >> >> * tree-profile.c: Include "ipa-inline.h". >> (gimple_gen_ic_func_profiler): Return bool. >> (tree_profiling): Call inline_free_summary to clear stale inline >> summary if gimple_gen_ic_func_profiler returns true. >> >> * value-prof.h (gimple_gen_ic_func_profiler): Change return >> type to bool. > > Hi, > My local tree is profedbootstrapping since I had local patch to > prevent recomputation it before ipa_profile pass, but I agree it is better > to not have stale inline summaries around. > >> + /* Clear stale inline summary. */ >> + if (gen_ic_func_profiler) >> + inline_free_summary (); > > The inline summary is completely dead here. It is computed for purposes of > early inlining and the real inliner will trash it and recompute soon. > (because the one computer by real inliner is more detailed). > > matrix_reorg, emutls and tm passes will also suffer from the problem of > invalidating the inling summary. It is better to free it early this. > > Can you simply add a micro pass just after pass_early_local_passes calliing > inline_free_summary unconditionally? > > Path is preapproved (or I will make it tomorrow unless you beat me). > This patch works passed profiledbootstrap with LTO as well as LTO -O3 on 176.gcc in SPEC CPU 2000. I have to add 2 inline_edge_summary_vec checks to avoid ICE. OK to install? Thanks. diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index ae32131..970be1e 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -3242,6 +3242,8 @@ void inline_free_summary (void) { struct cgraph_node *node; + if (inline_edge_summary_vec == NULL) + return; FOR_EACH_DEFINED_FUNCTION (node) reset_inline_summary (node); if (function_insertion_hook_holder) diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index 33cf7d2..7a8844f 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -1415,7 +1415,7 @@ execute_split_functions (void) } /* This can be relaxed; function might become inlinable after splitting away the uninlinable part. */ - if (!inline_summary (node)->inlinable) + if (inline_edge_summary_vec && !inline_summary (node)->inlinable) { if (dump_file) fprintf (dump_file, "Not splitting: not inlinable.\n"); diff --git a/gcc/ipa.c b/gcc/ipa.c index 9329d9b..e270591 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -448,6 +448,11 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) verify_symtab (); #endif + /* If we removed something, perhaps profile could be improved. */ + if (changed && optimize && inline_edge_summary_vec) + FOR_EACH_DEFINED_FUNCTION (node) + cgraph_propagate_frequency (node); + return changed; } @@ -960,6 +965,34 @@ struct simple_ipa_opt_pass pass_ipa_function_and_variable_visibility = } }; +/* Free inline summary. */ + +static unsigned +free_inline_summary (void) +{ + inline_free_summary (); + return 0; +} + +struct simple_ipa_opt_pass pass_ipa_free_inline_summary = +{ + { + SIMPLE_IPA_PASS, + "*free_inline_summary", /* name */ + NULL, /* gate */ + free_inline_summary, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_IPA_FREE_INLINE_SUMMARY, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_ggc_collect /* todo_flags_finish */ + } +}; + /* Do not re-run on ltrans stage. */ static bool diff --git a/gcc/passes.c b/gcc/passes.c index 7709671..fc4dbc5 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -1324,6 +1324,7 @@ init_optimization_passes (void) NEXT_PASS (pass_rebuild_cgraph_edges); NEXT_PASS (pass_inline_parameters); } + NEXT_PASS (pass_ipa_free_inline_summary); NEXT_PASS (pass_ipa_tree_profile); { struct opt_pass **p = &pass_ipa_tree_profile.pass.sub; diff --git a/gcc/timevar.def b/gcc/timevar.def index 18d419d..8fa1a2b 100644 --- a/gcc/timevar.def +++ b/gcc/timevar.def @@ -89,6 +89,7 @@ DEFTIMEVAR (TV_IPA_PURE_CONST , "ipa pure const") DEFTIMEVAR (TV_IPA_PTA , "ipa points-to") DEFTIMEVAR (TV_IPA_SRA , "ipa SRA") DEFTIMEVAR (TV_IPA_FREE_LANG_DATA , "ipa free lang data") +DEFTIMEVAR (TV_IPA_FREE_INLINE_SUMMARY, "ipa free inline summary") /* Time spent by constructing CFG. */ DEFTIMEVAR (TV_CFG , "cfg construction") /* Time spent by cleaning up CFG. */ diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index 081e48c..5037c29 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -377,6 +377,7 @@ extern struct simple_ipa_opt_pass pass_ipa_increase_alignment; extern struct simple_ipa_opt_pass pass_ipa_matrix_reorg; extern struct ipa_opt_pass_d pass_ipa_inline; extern struct simple_ipa_opt_pass pass_ipa_free_lang_data; +extern struct simple_ipa_opt_pass pass_ipa_free_inline_summary; extern struct ipa_opt_pass_d pass_ipa_cp; extern struct ipa_opt_pass_d pass_ipa_reference;