Backport from trunk r235478.
2016-04-27 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* params.def (MAX_PARTITION_SIZE): New param.
* invoke.texi: Document lto-max-partition.
gcc/lto/
Backport from trunk r235478.
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.
Change-Id: I4a8692c9278b4563ac2d6f97a5fbb586b4eb4450
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.
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;
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);
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)
{
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);
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 ();
"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,