From patchwork Thu Dec 1 21:08:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 128770 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 D41FFB6F18 for ; Fri, 2 Dec 2011 08:08:47 +1100 (EST) Received: (qmail 28675 invoked by alias); 1 Dec 2011 21:08:43 -0000 Received: (qmail 28663 invoked by uid 22791); 1 Dec 2011 21:08:41 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-yx0-f201.google.com (HELO mail-yx0-f201.google.com) (209.85.213.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Dec 2011 21:08:27 +0000 Received: by yenm6 with SMTP id m6so310696yen.2 for ; Thu, 01 Dec 2011 13:08:26 -0800 (PST) Received: by 10.236.168.70 with SMTP id j46mr15186624yhl.2.1322773706925; Thu, 01 Dec 2011 13:08:26 -0800 (PST) Received: by 10.236.168.70 with SMTP id j46mr15186613yhl.2.1322773706861; Thu, 01 Dec 2011 13:08:26 -0800 (PST) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id f15si1761562anq.1.2011.12.01.13.08.26 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 01 Dec 2011 13:08:26 -0800 (PST) Received: from wpaz1.hot.corp.google.com (wpaz1.hot.corp.google.com [172.24.198.65]) by wpzn4.hot.corp.google.com (Postfix) with ESMTPS id C6DEF1E004D; Thu, 1 Dec 2011 13:08:26 -0800 (PST) Received: from topo.tor.corp.google.com (topo.tor.corp.google.com [172.29.41.2]) by wpaz1.hot.corp.google.com with ESMTP id pB1L8PQX010598; Thu, 1 Dec 2011 13:08:26 -0800 Received: by topo.tor.corp.google.com (Postfix, from userid 54752) id 5C1D61DA1C6; Thu, 1 Dec 2011 16:08:25 -0500 (EST) To: reply@codereview.appspotmail.com, gcc-patches@gcc.gnu.org Subject: [PR bootstrap/51346] Fix lto profiledbootstrap (issue5437103) Message-Id: <20111201210825.5C1D61DA1C6@topo.tor.corp.google.com> Date: Thu, 1 Dec 2011 16:08:25 -0500 (EST) From: dnovillo@google.com (Diego Novillo) 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 These two patches fix the profiledbootstrap failure I caused earlier this week. The first patch reverts my original fix. The second one implements a different approach for this problem. Instead of trying to keep the edge attribute in sync with the statement, we do not use the edge attribute as long as there is a statement on that edge. This is still sub-optimal. We should only have a single no-inline attribute. Given that we sometimes have a callgraph without code, the attribute should be on the edge. Honza how hard would it be to implement that? In addition to fixing my internal build failure and the bootstrap, this fixes two tests: g++.dg/lto/20101020-1 gcc.c-torture/execute/920501-1.c Tested on x86_64 with profiledbootstrap. Committed to trunk. Diego. PR bootstrap/51346 Revert 2011-11-29 Diego Novillo * gimple.c (gimple_call_set_cannot_inline): Move from gimple.h. Update field call_stmt_cannot_inline_p from call graph edge, if needed. * gimple.h (gimple_call_set_cannot_inline): Move to gimple.c. PR bootstrap/51346 * ipa-inline.c (can_inline_edge_p): If the edge E has a statement, use the statement's inline indicator instead of E's. Remove consistency check. diff --git a/gcc/gimple.c b/gcc/gimple.c index d27e94b..071c651 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -5558,34 +5558,4 @@ gimple_asm_clobbers_memory_p (const_gimple stmt) return false; } - - -/* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */ - -void -gimple_call_set_cannot_inline (gimple s, bool inlinable_p) -{ - bool prev_inlinable_p; - - GIMPLE_CHECK (s, GIMPLE_CALL); - - prev_inlinable_p = gimple_call_cannot_inline_p (s); - - if (inlinable_p) - s->gsbase.subcode |= GF_CALL_CANNOT_INLINE; - else - s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE; - - /* If we have changed the inlinable attribute, and there is a call - graph edge going out of this statement, update its inlinable - attribute as well. */ - if (current_function_decl && prev_inlinable_p != inlinable_p) - { - struct cgraph_node *n = cgraph_get_node (current_function_decl); - struct cgraph_edge *e = cgraph_edge (n, s); - if (e) - e->call_stmt_cannot_inline_p = inlinable_p; - } -} - #include "gt-gimple.h" diff --git a/gcc/gimple.h b/gcc/gimple.h index df31bf3..8536c70 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -1035,7 +1035,6 @@ extern bool walk_stmt_load_store_ops (gimple, void *, extern bool gimple_ior_addresses_taken (bitmap, gimple); extern bool gimple_call_builtin_p (gimple, enum built_in_function); extern bool gimple_asm_clobbers_memory_p (const_gimple); -extern void gimple_call_set_cannot_inline (gimple, bool); /* In gimplify.c */ extern tree create_tmp_var_raw (tree, const char *); @@ -2344,6 +2343,19 @@ gimple_call_tail_p (gimple s) } +/* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */ + +static inline void +gimple_call_set_cannot_inline (gimple s, bool inlinable_p) +{ + GIMPLE_CHECK (s, GIMPLE_CALL); + if (inlinable_p) + s->gsbase.subcode |= GF_CALL_CANNOT_INLINE; + else + s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE; +} + + /* Return true if GIMPLE_CALL S cannot be inlined. */ static inline bool -- 1.7.3.1 diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 3dadf8d..e3c6b3c 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -246,6 +246,14 @@ can_inline_edge_p (struct cgraph_edge *e, bool report) struct function *caller_cfun = DECL_STRUCT_FUNCTION (e->caller->decl); struct function *callee_cfun = callee ? DECL_STRUCT_FUNCTION (callee->decl) : NULL; + bool call_stmt_cannot_inline_p; + + /* If E has a call statement in it, use the inline attribute from + the statement, otherwise use the inline attribute in E. Edges + will not have statements when working in WPA mode. */ + call_stmt_cannot_inline_p = (e->call_stmt) + ? gimple_call_cannot_inline_p (e->call_stmt) + : e->call_stmt_cannot_inline_p; if (!caller_cfun && e->caller->clone_of) caller_cfun = DECL_STRUCT_FUNCTION (e->caller->clone_of->decl); @@ -270,7 +278,7 @@ can_inline_edge_p (struct cgraph_edge *e, bool report) e->inline_failed = CIF_OVERWRITABLE; return false; } - else if (e->call_stmt_cannot_inline_p) + else if (call_stmt_cannot_inline_p) { e->inline_failed = CIF_MISMATCHED_ARGUMENTS; inlinable = false; @@ -343,14 +351,6 @@ can_inline_edge_p (struct cgraph_edge *e, bool report) } } - /* Be sure that the cannot_inline_p flag is up to date. */ - gcc_checking_assert (!e->call_stmt - || (gimple_call_cannot_inline_p (e->call_stmt) - == e->call_stmt_cannot_inline_p) - /* In -flto-partition=none mode we really keep things out of - sync because call_stmt_cannot_inline_p is set at cgraph - merging when function bodies are not there yet. */ - || (in_lto_p && !gimple_call_cannot_inline_p (e->call_stmt))); if (!inlinable && report) report_inline_failed_reason (e); return inlinable;