From patchwork Tue Sep 7 21:28:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 64072 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 D5057B6F06 for ; Wed, 8 Sep 2010 07:29:04 +1000 (EST) Received: (qmail 682 invoked by alias); 7 Sep 2010 21:29:02 -0000 Received: (qmail 669 invoked by uid 22791); 7 Sep 2010 21:29:01 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam-dmz.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Sep 2010 21:28:55 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 528589AC85D; Tue, 7 Sep 2010 23:28:53 +0200 (CEST) Date: Tue, 7 Sep 2010 23:28:53 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Avoid use of DECL_REPLACEABLE in tree-inline Message-ID: <20100907212853.GF12341@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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, this patch removes tree-inline from testing DECL_REPLACEABLE. We should not do that early, since DECL_REPLACEABLE might become false as the effect of -fwhole-program or LTO later during compilatoin and we do not want to prevent inlining of such functions. Instead inliner now tests availability itself to prevent inlining. Bootstrapped/regtested x86_64-linux, comitted. Honza * tree-inline.c (tree_inlinable_function_p): Do not test DECL_REPLACEABLE_P. * ipa-inline.c (cgraph_default_inline_p, update_caller_keys, update_callee_keys, cgraph_decide_inlining): Test function availability. * cif-code.def (OVERWRITABLE): New code. Index: tree-inline.c =================================================================== --- tree-inline.c (revision 163947) +++ tree-inline.c (working copy) @@ -3197,12 +3197,6 @@ tree_inlinable_function_p (tree fn) inlinable = false; } - /* Don't auto-inline anything that might not be bound within - this unit of translation. */ - else if (!DECL_DECLARED_INLINE_P (fn) - && DECL_REPLACEABLE_P (fn)) - inlinable = false; - else if (!function_attribute_inlinable_p (fn)) { if (do_warning) Index: ipa-inline.c =================================================================== --- ipa-inline.c (revision 163947) +++ ipa-inline.c (working copy) @@ -480,13 +480,19 @@ cgraph_default_inline_p (struct cgraph_n *reason = CIF_FUNCTION_NOT_INLINE_CANDIDATE; return false; } - if (!n->analyzed) { if (reason) *reason = CIF_BODY_NOT_AVAILABLE; return false; } + if (cgraph_function_body_availability (n) <= AVAIL_OVERWRITABLE) + { + if (reason) + *reason = CIF_OVERWRITABLE; + return false; + } + if (DECL_DECLARED_INLINE_P (decl)) { @@ -697,6 +703,7 @@ update_caller_keys (fibheap_t heap, stru cgraph_inline_failed_t failed_reason; if (!node->local.inlinable + || cgraph_function_body_availability (node) <= AVAIL_OVERWRITABLE || node->global.inlined_to) return; if (!bitmap_set_bit (updated_nodes, node->uid)) @@ -749,6 +756,7 @@ update_callee_keys (fibheap_t heap, stru { if (e->inline_failed && e->callee->local.inlinable + && cgraph_function_body_availability (e->callee) >= AVAIL_AVAILABLE && !bitmap_bit_p (updated_nodes, e->callee->uid)) { node->global.estimated_growth = INT_MIN; @@ -1499,6 +1507,7 @@ cgraph_decide_inlining (void) && !node->callers->next_caller && cgraph_will_be_removed_from_program_if_no_direct_calls (node) && node->local.inlinable + && cgraph_function_body_availability (node) >= AVAIL_AVAILABLE && node->callers->inline_failed && node->callers->caller != node && node->callers->caller->global.inlined_to != node Index: cif-code.def =================================================================== --- cif-code.def (revision 163947) +++ cif-code.def (working copy) @@ -88,3 +88,5 @@ DEFCIFCODE(ORIGINALLY_INDIRECT_CALL, /* Ths edge represents an indirect edge with a yet-undetermined callee . */ DEFCIFCODE(INDIRECT_UNKNOWN_CALL, N_("indirect function call with a yet undetermined callee")) + +DEFCIFCODE(OVERWRITABLE, N_("function body can be overwriten at linktime"))