public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: gcc-patches@gcc.gnu.org
Subject: Empty LTO partition fix
Date: Sat, 18 Jun 2011 12:42:00 -0000	[thread overview]
Message-ID: <20110618104954.GA28018@kam.mff.cuni.cz> (raw)

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

                 reply	other threads:[~2011-06-18 10:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110618104954.GA28018@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).