]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
params.def (MAX_PARTITION_SIZE): New param.
authorPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Wed, 27 Apr 2016 10:46:16 +0000 (10:46 +0000)
committerPrathamesh Kulkarni <prathamesh3492@gcc.gnu.org>
Wed, 27 Apr 2016 10:46:16 +0000 (10:46 +0000)
2016-04-27  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

* params.def (MAX_PARTITION_SIZE): New param.
* invoke.texi: Document lto-max-partition.
lto/
* lto-partition.h (lto_balanced_map): New parameter.
* lto-partition.c (lto_balanced_map): New parameter
max_partition_size.
Check if partition size is greater than max_partition_size.
* lto.c (do_whole_program_analysis): Adjust calls to
lto_balanced_map() to pass 2nd argument.

From-SVN: r235478

gcc/ChangeLog
gcc/doc/invoke.texi
gcc/lto/ChangeLog
gcc/lto/lto-partition.c
gcc/lto/lto-partition.h
gcc/lto/lto.c
gcc/params.def

index 38dd7c83f157ef490c0f57296b187e3ae717f66a..dc4429ad03d3bc3fa4fae7c033b393ff184de6fb 100644 (file)
@@ -1,3 +1,8 @@
+2016-04-27  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
+
+       * params.def (MAX_PARTITION_SIZE): New param.
+       * invoke.texi: Document lto-max-partition.
+
 2016-04-27  Richard Biener  <rguenther@suse.de>
 
        PR ipa/70785
index 67760b5b45591da1f04423de32fa6113bb565ecd..6e343c5cadae8efc0eb931b1a3353bc537107519 100644 (file)
@@ -9490,6 +9490,11 @@ Size of minimal partition for WHOPR (in estimated instructions).
 This prevents expenses of splitting very small programs into too many
 partitions.
 
+@item lto-max-partition
+Size of max partition for WHOPR (in estimated instructions).
+to provide an upper bound for individual size of partition.
+Meant to be used only with balanced partitioning.
+
 @item cxx-max-namespaces-for-diagnostic-help
 The maximum number of namespaces to consult for suggestions when C++
 name lookup fails for an identifier.  The default is 1000.
index dbb69a2e076cf1b6712e9b3fef93254d89886ebd..b1421cbe733bb76772f90b23b86e43da7dcef5b7 100644 (file)
@@ -1,3 +1,12 @@
+2016-04-27  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
+
+       * lto-partition.h (lto_balanced_map): New parameter.
+       * lto-partition.c (lto_balanced_map): New parameter
+       max_partition_size.
+       Check if partition size is greater than max_partition_size.
+       * lto.c (do_whole_program_analysis): Adjust calls to
+       lto_balanced_map() to pass 2nd argument.
+
 2016-03-17  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR lto/70258
index 9eb63c27f33213c8e9a050bc5a57efb41be385d0..c191d24b497306554967c3e1c0c6afc64ab9616b 100644 (file)
@@ -447,7 +447,7 @@ add_sorted_nodes (vec<symtab_node *> &next_nodes, ltrans_partition partition)
    and in-partition calls was reached.  */
 
 void
-lto_balanced_map (int n_lto_partitions)
+lto_balanced_map (int n_lto_partitions, int max_partition_size)
 {
   int n_nodes = 0;
   int n_varpool_nodes = 0, varpool_pos = 0, best_varpool_pos = 0;
@@ -511,6 +511,9 @@ lto_balanced_map (int n_lto_partitions)
   varpool_order.qsort (varpool_node_cmp);
 
   /* Compute partition size and create the first partition.  */
+  if (PARAM_VALUE (MIN_PARTITION_SIZE) > max_partition_size)
+    fatal_error (input_location, "min partition size cannot be greater than max partition size");
+
   partition_size = total_size / n_lto_partitions;
   if (partition_size < PARAM_VALUE (MIN_PARTITION_SIZE))
     partition_size = PARAM_VALUE (MIN_PARTITION_SIZE);
@@ -719,7 +722,8 @@ lto_balanced_map (int n_lto_partitions)
                 best_cost, best_internal, best_i);
       /* Partition is too large, unwind into step when best cost was reached and
         start new partition.  */
-      if (partition->insns > 2 * partition_size)
+      if (partition->insns > 2 * partition_size
+         || partition->insns > max_partition_size)
        {
          if (best_i != i)
            {
index 31e3764ecddf16ccd0bcd1e5d45fdc3750c205bf..f7abe620257eb6651fe34f56a4ce7c8e937e4682 100644 (file)
@@ -35,7 +35,7 @@ extern vec<ltrans_partition> ltrans_partitions;
 
 void lto_1_to_1_map (void);
 void lto_max_map (void);
-void lto_balanced_map (int);
+void lto_balanced_map (int, int);
 void lto_promote_cross_file_statics (void);
 void free_ltrans_partitions (void);
 void lto_promote_statics_nonwpa (void);
index 9dd513fef8668346dcfa6716ccc8cc649e52ddad..af735cb179333e063ebb96da756d1fe5a0f8e4ef 100644 (file)
@@ -3117,9 +3117,10 @@ do_whole_program_analysis (void)
   else if (flag_lto_partition == LTO_PARTITION_MAX)
     lto_max_map ();
   else if (flag_lto_partition == LTO_PARTITION_ONE)
-    lto_balanced_map (1);
+    lto_balanced_map (1, INT_MAX);
   else if (flag_lto_partition == LTO_PARTITION_BALANCED)
-    lto_balanced_map (PARAM_VALUE (PARAM_LTO_PARTITIONS));
+    lto_balanced_map (PARAM_VALUE (PARAM_LTO_PARTITIONS),
+                     PARAM_VALUE (MAX_PARTITION_SIZE));
   else
     gcc_unreachable ();
 
index dbff305b7f40a2ff36170785a1097757e6a76dd0..eceee32d87684169cada8db1d16e50077e53eb69 100644 (file)
@@ -1029,6 +1029,11 @@ DEFPARAM (MIN_PARTITION_SIZE,
          "Minimal size of a partition for LTO (in estimated instructions).",
          1000, 0, 0)
 
+DEFPARAM (MAX_PARTITION_SIZE,
+         "lto-max-partition",
+         "Maximal size of a partition for LTO (in estimated instructions).",
+         1000000, 0, INT_MAX)
+
 /* Diagnostic parameters.  */
 
 DEFPARAM (CXX_MAX_NAMESPACES_FOR_DIAGNOSTIC_HELP,