public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Empty LTO partition fix
@ 2011-06-18 12:42 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2011-06-18 12:42 UTC (permalink / raw)
  To: gcc-patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-18 10:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-18 12:42 Empty LTO partition fix Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).