From patchwork Tue Oct 26 21:34:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 69294 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 16E2BB70AA for ; Wed, 27 Oct 2010 08:34:59 +1100 (EST) Received: (qmail 15615 invoked by alias); 26 Oct 2010 21:34:48 -0000 Received: (qmail 15497 invoked by uid 22791); 26 Oct 2010 21:34:47 -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, 26 Oct 2010 21:34:41 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 7E1409ACA2E; Tue, 26 Oct 2010 23:34:39 +0200 (CEST) Date: Tue, 26 Oct 2010 23:34:39 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: More cgraph_remove_unreachable_nodes fixes Message-ID: <20101026213439.GA3813@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, cgraph_remove_unreachable_nodes still remove masters of clones from othr partitions that confuse sanity checking. Fixed by the following patch that also cleans up how things are queued. Everything that is referenced by live part of cgraph is enqueued, everything that is really reachable gets reachable flag. Bootstrapped/regtested x86_64-linux, also lto-bootstrapped and comitted. * ipa.c (process_references): Enqueue all referenced nodes; mark as reachable only non-external nodes. (cgraph_remove_unreachable_nodes): All referenced nodes should be enqueued; remove bogues node->needed check. Index: ipa.c =================================================================== --- ipa.c (revision 165985) +++ ipa.c (working copy) @@ -170,12 +170,11 @@ process_references (struct ipa_ref_list { struct cgraph_node *node = ipa_ref_node (ref); if (!node->reachable + && node->analyzed && (!DECL_EXTERNAL (node->decl) || before_inlining_p)) - { - node->reachable = true; - enqueue_cgraph_node (node, first); - } + node->reachable = true; + enqueue_cgraph_node (node, first); } else { @@ -304,15 +303,15 @@ cgraph_remove_unreachable_nodes (bool be if (node->reachable) { for (e = node->callees; e; e = e->next_callee) - if (!e->callee->reachable - && node->analyzed - && (!e->inline_failed || !e->callee->analyzed - || (!DECL_EXTERNAL (e->callee->decl)) - || before_inlining_p)) - { + { + if (!e->callee->reachable + && node->analyzed + && (!e->inline_failed + || !DECL_EXTERNAL (e->callee->decl) + || before_inlining_p)) e->callee->reachable = true; - enqueue_cgraph_node (e->callee, &first); - } + enqueue_cgraph_node (e->callee, &first); + } process_references (&node->ref_list, &first, &first_varpool, before_inlining_p); } @@ -416,7 +415,7 @@ cgraph_remove_unreachable_nodes (bool be found = true; /* If so, we need to keep node in the callgraph. */ - if (found || node->needed) + if (found) { if (node->analyzed) {