From patchwork Sat Jan 7 09:46:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dehao Chen X-Patchwork-Id: 134845 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 BA2DAB6F70 for ; Sat, 7 Jan 2012 20:47:10 +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=1326534431; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=G13thc/68CXOOP8KjZ9yZS9/TuI=; b=hR5x3FiKxeuOLzm QEdXLFcpcaOTH08i6WzEcF8mB+S8bNCrQHQbEpLrK6UtSvS6tZuDS1rDnItEatEj dgZ6+1b6xxqgbb72rvBXz0wHkdlhctRbj80a0NoZIT7c1JWhr5b5T+LVp5NMxJaE XHI+Xn0r9UPVOE945RZlZMb1bEcU= 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:Received:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:X-System-Of-Record:Content-Type:Content-Transfer-Encoding:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=YhUELLNOn0TOZtWCI4DflyN9IZhstgQgj/dHYZF5MYNi2mQGLN+uKuZUz+UiXZ VvLx0FVuwtGsAWHyYlU8zpcugGTwWBoJT6Oq9UCKjAke4ri54lnhoNqEtkLGwPFG zLuwM8mfUC27hFn/aq+Q6ekUL0BpkXRFmoStMXCYnPfBE=; Received: (qmail 25363 invoked by alias); 7 Jan 2012 09:47:07 -0000 Received: (qmail 25349 invoked by uid 22791); 7 Jan 2012 09:47:05 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, TW_CP, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-iy0-f175.google.com (HELO mail-iy0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 07 Jan 2012 09:46:51 +0000 Received: by iakh37 with SMTP id h37so3972525iak.20 for ; Sat, 07 Jan 2012 01:46:50 -0800 (PST) Received: by 10.50.222.193 with SMTP id qo1mr10848754igc.22.1325929610670; Sat, 07 Jan 2012 01:46:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.222.193 with SMTP id qo1mr10848740igc.22.1325929610569; Sat, 07 Jan 2012 01:46:50 -0800 (PST) Received: by 10.50.23.70 with HTTP; Sat, 7 Jan 2012 01:46:50 -0800 (PST) In-Reply-To: References: Date: Sat, 7 Jan 2012 17:46:50 +0800 Message-ID: Subject: Re: [google] Dump inline decisions more wisely From: Dehao Chen To: Xinliang David Li Cc: gcc-patches@gcc.gnu.org X-System-Of-Record: true 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 Here is the new patch. Thanks, Dehao On Fri, Jan 6, 2012 at 1:39 PM, Xinliang David Li wrote: > Not ideal but better. Ok with this change. > > David > > On Thu, Jan 5, 2012 at 5:47 PM, Dehao Chen wrote: >> Or use a new global variable to denote whether it's in early-inline or >> ipa-inline? >> >> Dehao >> >> On Fri, Jan 6, 2012 at 1:46 AM, Xinliang David Li wrote: >>> >>> Is there a better way to detect early inline phase and ipa_inline >>> pass? Use always_inline_functions_inlined flag seems hacky. >>> >>> David >>> >>> On Wed, Jan 4, 2012 at 1:12 AM, Dehao Chen wrote: >>> > Hi, >>> > >>> > This patch: >>> > >>> > * dump inline decisions with profile info whenever available. >>> > * disable dump of einline decisions at OPT_INFO_MIN. >>> > >>> > Is it ok for google branches? >>> > >>> > thanks, >>> > Dehao >>> > >>> > 2012-01-04  Dehao Chen   >>> > >>> >        * ipa-inline.c (cgraph_node_opt_info): Print profile info if available >>> >        (dump_inline_decision): Disable einline dump at OPT_INFO_MIN >>> > >>> > Index: gcc/ipa-inline.c >>> > =================================================================== >>> > --- gcc/ipa-inline.c    (revision 182864) >>> > +++ gcc/ipa-inline.c    (working copy) >>> > @@ -308,12 +308,12 @@ >>> >     bfd_name = "unknown"; >>> > >>> >   buf_size = strlen (bfd_name) + 1; >>> > -  if (flag_opt_info >= OPT_INFO_MED && profile_info) >>> > +  if (profile_info) >>> >     buf_size += (2 * MAX_INT_LENGTH + 5); >>> >   buf = (char *) xmalloc (buf_size); >>> > >>> >   strcpy (buf, bfd_name); >>> > -  if (flag_opt_info >= OPT_INFO_MED && profile_info) >>> > +  if (profile_info) >>> >     sprintf (buf, >>> >             "%s ("HOST_WIDEST_INT_PRINT_DEC", "HOST_WIDEST_INT_PRINT_DEC")", >>> >             buf, node->count, node->max_bb_count); >>> > @@ -364,6 +364,16 @@ >>> >   const char *call_count_text; >>> >   struct cgraph_node *final_caller = edge->caller; >>> > >>> > +  if (flag_opt_info < OPT_INFO_MED) >>> > +    { >>> > +      tree decl = edge->caller->decl; >>> > +      if (decl) >>> > +       { >>> > +         struct function *fn = DECL_STRUCT_FUNCTION (decl); >>> > +         if (!fn || !fn->always_inline_functions_inlined) >>> > +           return; >>> > +       } >>> > +    } >>> >   if (final_caller->global.inlined_to != NULL) >>> >     inline_chain_text = cgraph_node_call_chain (final_caller, &final_caller); >>> >   else Index: gcc/ipa-inline.c =================================================================== --- gcc/ipa-inline.c (revision 182864) +++ gcc/ipa-inline.c (working copy) @@ -308,12 +308,12 @@ bfd_name = "unknown"; buf_size = strlen (bfd_name) + 1; - if (flag_opt_info >= OPT_INFO_MED && profile_info) + if (profile_info) buf_size += (2 * MAX_INT_LENGTH + 5); buf = (char *) xmalloc (buf_size); strcpy (buf, bfd_name); - if (flag_opt_info >= OPT_INFO_MED && profile_info) + if (profile_info) sprintf (buf, "%s ("HOST_WIDEST_INT_PRINT_DEC", "HOST_WIDEST_INT_PRINT_DEC")", buf, node->count, node->max_bb_count); @@ -354,6 +354,9 @@ return buf; } +/* File static variable to denote if it is in ipa-inline pass. */ +static bool is_in_ipa_inline = false; + /* Dump the inline decision of EDGE to stderr. */ static void @@ -364,6 +367,8 @@ const char *call_count_text; struct cgraph_node *final_caller = edge->caller; + if (flag_opt_info < OPT_INFO_MED && !is_in_ipa_inline) + return; if (final_caller->global.inlined_to != NULL) inline_chain_text = cgraph_node_call_chain (final_caller, &final_caller); else @@ -1193,6 +1198,8 @@ int min_size, max_size; VEC (cgraph_edge_p, heap) *new_indirect_edges = NULL; + is_in_ipa_inline = true; + if (flag_indirect_inlining) new_indirect_edges = VEC_alloc (cgraph_edge_p, heap, 8);