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 ("");