]> gcc.gnu.org Git - gcc.git/commitdiff
lto-partition.c (lto_balanced_map): Always base order on source file order.
authorJan Hubicka <jh@suse.cz>
Wed, 28 Aug 2013 06:51:27 +0000 (08:51 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 28 Aug 2013 06:51:27 +0000 (06:51 +0000)
* lto-partition.c (lto_balanced_map): Always base order on
source file order.

Co-Authored-By: Martin Liska <marxin.liska@gmail.com>
From-SVN: r202041

gcc/lto/ChangeLog
gcc/lto/lto-partition.c

index cb10a4bf8c8d55ba97a6f1b30a6fbc34d7363e7a..3ffc5f660af1142cc38089eec09825860cc3d7fd 100644 (file)
@@ -1,3 +1,9 @@
+2013-08-06  Jan Hubicka  <jh@suse.cz>
+           Martin Liska  <marxin.liska@gmail.com>
+
+       * lto-partition.c (lto_balanced_map): Always base order on 
+       source file order.
+
 2013-08-06  Jan Hubicka  <jh@suse.cz>
 
        * lto.c (lto_materialize_function): Do not read body anymore.
index 879218ce2fa9b7c967ce963cf4258ac46067913e..e05f805fea448d2874d2240ff13eec76786c13ca 100644 (file)
@@ -449,11 +449,9 @@ lto_balanced_map (void)
 {
   int n_nodes = 0;
   int n_varpool_nodes = 0, varpool_pos = 0, best_varpool_pos = 0;
-  struct cgraph_node **postorder =
-    XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
   struct cgraph_node **order = XNEWVEC (struct cgraph_node *, cgraph_max_uid);
   struct varpool_node **varpool_order = NULL;
-  int i, postorder_len;
+  int i;
   struct cgraph_node *node;
   int total_size = 0, best_total_size = 0;
   int partition_size;
@@ -468,24 +466,20 @@ lto_balanced_map (void)
 
   FOR_EACH_VARIABLE (vnode)
     gcc_assert (!vnode->symbol.aux);
-  /* Until we have better ordering facility, use toplogical order.
-     Include only nodes we will partition and compute estimate of program
-     size.  Note that since nodes that are not partitioned might be put into
-     multiple partitions, this is just an estimate of real size.  This is why
-     we keep partition_size updated after every partition is finalized.  */
-  postorder_len = ipa_reverse_postorder (postorder);
     
-  for (i = 0; i < postorder_len; i++)
-    {
-      node = postorder[i];
-      if (get_symbol_class ((symtab_node) node) == SYMBOL_PARTITION)
-       {
-         order[n_nodes++] = node;
-          total_size += inline_summary (node)->size;
-       }
-    }
-  free (postorder);
+  FOR_EACH_DEFINED_FUNCTION (node)
+    if (get_symbol_class ((symtab_node) node) == SYMBOL_PARTITION)
+      {
+       order[n_nodes++] = node;
+       total_size += inline_summary (node)->size;
+      }
 
+  /* Streaming works best when the source units do not cross partition
+     boundaries much.  This is because importing function from a source
+     unit tends to import a lot of global trees defined there.  We should
+     get better about minimizing the function bounday, but until that
+     things works smoother if we order in source order.  */
+  qsort (order, n_nodes, sizeof (struct cgraph_node *), node_cmp);
   if (!flag_toplevel_reorder)
     {
       qsort (order, n_nodes, sizeof (struct cgraph_node *), node_cmp);
This page took 0.074918 seconds and 5 git commands to generate.