From patchwork Fri Oct 8 00:52:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 67123 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 42C0AB6EEE for ; Fri, 8 Oct 2010 11:52:13 +1100 (EST) Received: (qmail 21649 invoked by alias); 8 Oct 2010 00:52:12 -0000 Received: (qmail 21640 invoked by uid 22791); 8 Oct 2010 00:52:11 -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; Fri, 08 Oct 2010 00:52:07 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id C75AF9AC88F; Fri, 8 Oct 2010 02:52:04 +0200 (CEST) Date: Fri, 8 Oct 2010 02:52:04 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix WHOPR partitioning WRT whole unit size Message-ID: <20101008005204.GI5152@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, lto_balanced_map accounts incorrectly whole unit size that makes it to get into negative size after some while that leads it to produce a new partition for every function. This blats streaming off the space and size that happens for some of spec2006 benchmarks. Fixed thus. I went ahead and comitted it as obvious, so the testers are not affected for too long. Bootstrapped/regtested x86_64-linux. Honza * lto.c (lto_balanced_map): Fix account of whole unit size. Index: lto.c =================================================================== --- lto.c (revision 165138) +++ lto.c (working copy) @@ -995,7 +991,7 @@ struct cgraph_node **order = XNEWVEC (struct cgraph_node *, cgraph_max_uid); int i, postorder_len; struct cgraph_node *node; - int total_size = 0; + int total_size = 0, best_total_size = 0; int partition_size; ltrans_partition partition; unsigned int last_visited_cgraph_node = 0, last_visited_varpool_node = 0; @@ -1017,7 +1013,7 @@ if (partition_cgraph_node_p (node)) { order[n_nodes++] = node; - total_size += node->local.inline_summary.self_size; + total_size += node->global.size; } } free (postorder); @@ -1035,6 +1031,7 @@ for (i = 0; i < n_nodes; i++) { add_cgraph_node_to_partition (partition, order[i]); + total_size -= order[i]->global.size; /* Once we added a new node to the partition, we also want to add all referenced variables unless they was already added into some @@ -1069,7 +1066,6 @@ last_visited_cgraph_node); refs = &node->ref_list; - total_size -= node->local.inline_summary.self_size; last_visited_cgraph_node++; gcc_assert (node->analyzed); @@ -1195,6 +1191,7 @@ partition->cgraph_set->nodes); best_n_varpool_nodes = VEC_length (varpool_node_ptr, partition->varpool_set->nodes); + best_total_size = total_size; } if (cgraph_dump_file) fprintf (cgraph_dump_file, "Step %i: added %s, size %i, cost %i/%i best %i/%i, step %i\n", i, @@ -1218,6 +1215,7 @@ partition = new_partition (""); last_visited_cgraph_node = 0; last_visited_varpool_node = 0; + total_size = best_total_size; cost = 0; if (cgraph_dump_file)