From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13971 invoked by alias); 18 Jun 2011 10:50:10 -0000 Received: (qmail 13962 invoked by uid 22791); 18 Jun 2011 10:50:09 -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.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 18 Jun 2011 10:49:55 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 3C8DD9AC786; Sat, 18 Jun 2011 12:49:54 +0200 (CEST) Date: Sat, 18 Jun 2011 12:42:00 -0000 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Empty LTO partition fix Message-ID: <20110618104954.GA28018@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg01386.txt.bz2 Hi, the empty partitions gets created when node gets assigned to earlier partition. This happens for thunks, aliases and partitioned comdats. Hope this will fix all occurences of the problem. Bootstrapped/regtested x86_64-linux Honza PR lto/23754 * lto.c (lto_1_to_1_map): Don't create empty partitions. (lto_balanced_map): Likewise. Index: lto.c =================================================================== *** lto.c (revision 175166) --- lto.c (working copy) *************** lto_1_to_1_map (void) *** 1516,1522 **** for (node = cgraph_nodes; node; node = node->next) { ! if (!partition_cgraph_node_p (node)) continue; file_data = node->local.lto_file_data; --- 1516,1523 ---- for (node = cgraph_nodes; node; node = node->next) { ! if (!partition_cgraph_node_p (node) ! || node->aux) continue; file_data = node->local.lto_file_data; *************** lto_1_to_1_map (void) *** 1545,1557 **** npartitions++; } ! if (!node->aux) ! add_cgraph_node_to_partition (partition, node); } for (vnode = varpool_nodes; vnode; vnode = vnode->next) { ! if (!partition_varpool_node_p (vnode)) continue; file_data = vnode->lto_file_data; slot = pointer_map_contains (pmap, file_data); --- 1546,1558 ---- npartitions++; } ! add_cgraph_node_to_partition (partition, node); } for (vnode = varpool_nodes; vnode; vnode = vnode->next) { ! if (!partition_varpool_node_p (vnode) ! || vnode->aux) continue; file_data = vnode->lto_file_data; slot = pointer_map_contains (pmap, file_data); *************** lto_1_to_1_map (void) *** 1565,1572 **** npartitions++; } ! if (!vnode->aux) ! add_varpool_node_to_partition (partition, vnode); } for (node = cgraph_nodes; node; node = node->next) node->aux = NULL; --- 1566,1572 ---- npartitions++; } ! add_varpool_node_to_partition (partition, vnode); } for (node = cgraph_nodes; node; node = node->next) node->aux = NULL; *************** lto_balanced_map (void) *** 1675,1682 **** for (i = 0; i < n_nodes; i++) { ! if (!order[i]->aux) ! add_cgraph_node_to_partition (partition, order[i]); total_size -= inline_summary (order[i])->size; /* Once we added a new node to the partition, we also want to add --- 1675,1683 ---- for (i = 0; i < n_nodes; i++) { ! if (order[i]->aux) ! continue; ! add_cgraph_node_to_partition (partition, order[i]); total_size -= inline_summary (order[i])->size; /* Once we added a new node to the partition, we also want to add *************** lto_balanced_map (void) *** 1856,1861 **** --- 1857,1864 ---- } i = best_i; /* When we are finished, avoid creating empty partition. */ + while (i < n_nodes - 1 && order[i + 1]->aux) + i++; if (i == n_nodes - 1) break; partition = new_partition ("");