Commit 5a6bc9c7 by James Greenhalgh Committed by James Greenhalgh

[Patchv3] Control SRA and IPA-SRA by a param rather than MOVE_RATIO

gcc/

	* params.def (sra-max-scalarization-size-Ospeed): New.
	(sra-max-scalarization-size-Osize): Likewise.
	* doc/invoke.texi (sra-max-scalarization-size-Ospeed): Document.
	(sra-max-scalarization-size-Osize): Likewise.
	* toplev.c (process_options): Set default values for new
	parameters.
	* tree-sra.c (analyze_all_variable_accesses): Use new parameters.
	* targhooks.c (get_move_ratio): Remove static designator.
	* target.h (get_move_ratio): Declare.

From-SVN: r217191
parent 34896cd6
2014-11-06 James Greenhalgh <james.greenhalgh@arm.com>
* params.def (sra-max-scalarization-size-Ospeed): New.
(sra-max-scalarization-size-Osize): Likewise.
* doc/invoke.texi (sra-max-scalarization-size-Ospeed): Document.
(sra-max-scalarization-size-Osize): Likewise.
* toplev.c (process_options): Set default values for new
parameters.
* tree-sra.c (analyze_all_variable_accesses): Use new parameters.
* targhooks.c (get_move_ratio): Remove static designator.
* target.h (get_move_ratio): Declare.
2014-11-06 Marek Polacek <polacek@redhat.com>
* sanopt.c (sanopt_optimize_walker): Limit removal of the checks.
......@@ -10401,6 +10401,16 @@ parameters only when their cumulative size is less or equal to
@option{ipa-sra-ptr-growth-factor} times the size of the original
pointer parameter.
@item sra-max-scalarization-size-Ospeed
@item sra-max-scalarization-size-Osize
The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
replace scalar parts of aggregates with uses of independent scalar
variables. These parameters control the maximum size, in storage units,
of aggregate which will be considered for replacement when compiling for
speed
(@option{sra-max-scalarization-size-Ospeed}) or size
(@option{sra-max-scalarization-size-Osize}) respectively.
@item tm-max-aggregate-size
When making copies of thread-local variables in a transaction, this
parameter specifies the size in bytes after which variables are
......
......@@ -950,6 +950,18 @@ DEFPARAM (PARAM_TM_MAX_AGGREGATE_SIZE,
"pairs",
9, 0, 0)
DEFPARAM (PARAM_SRA_MAX_SCALARIZATION_SIZE_SPEED,
"sra-max-scalarization-size-Ospeed",
"Maximum size, in storage units, of an aggregate which should be "
"considered for scalarization when compiling for speed",
0, 0, 0)
DEFPARAM (PARAM_SRA_MAX_SCALARIZATION_SIZE_SIZE,
"sra-max-scalarization-size-Osize",
"Maximum size, in storage units, of an aggregate which should be "
"considered for scalarization when compiling for size",
0, 0, 0)
DEFPARAM (PARAM_IPA_CP_VALUE_LIST_SIZE,
"ipa-cp-value-list-size",
"Maximum size of a list of values associated with each parameter for "
......
......@@ -102,6 +102,10 @@ extern int elf_record_gcc_switches (print_switch_type type, const char *);
we disable such optimizations on such targets, using this function. */
extern bool target_default_pointer_address_modes_p (void);
/* For hooks which use the MOVE_RATIO macro, this gives the legacy default
behaviour. */
extern unsigned int get_move_ratio (bool);
struct stdarg_info;
struct spec_info_def;
struct hard_reg_set_container;
......
......@@ -1409,7 +1409,7 @@ default_register_move_cost (machine_mode mode ATTRIBUTE_UNUSED,
/* For hooks which use the MOVE_RATIO macro, this gives the legacy default
behaviour. SPEED_P is true if we are compiling for speed. */
static unsigned int
unsigned int
get_move_ratio (bool speed_p ATTRIBUTE_UNUSED)
{
unsigned int move_ratio;
......
......@@ -1270,6 +1270,20 @@ process_options (void)
so we can correctly initialize debug output. */
no_backend = lang_hooks.post_options (&main_input_filename);
/* Set default values for parameters relation to the Scalar Reduction
of Aggregates passes (SRA and IP-SRA). We must do this here, rather
than in opts.c:default_options_optimization as historically these
tuning heuristics have been based on MOVE_RATIO, which on some
targets requires other symbols from the backend. */
maybe_set_param_value
(PARAM_SRA_MAX_SCALARIZATION_SIZE_SPEED,
get_move_ratio (true) * UNITS_PER_WORD,
global_options.x_param_values, global_options_set.x_param_values);
maybe_set_param_value
(PARAM_SRA_MAX_SCALARIZATION_SIZE_SIZE,
get_move_ratio (false) * UNITS_PER_WORD,
global_options.x_param_values, global_options_set.x_param_values);
/* Some machines may reject certain combinations of options. */
targetm.target_option.override ();
......
......@@ -2511,10 +2511,12 @@ analyze_all_variable_accesses (void)
int res = 0;
bitmap tmp = BITMAP_ALLOC (NULL);
bitmap_iterator bi;
unsigned i, max_total_scalarization_size;
max_total_scalarization_size = UNITS_PER_WORD * BITS_PER_UNIT
* MOVE_RATIO (optimize_function_for_speed_p (cfun));
unsigned i;
unsigned max_scalarization_size
= (optimize_function_for_size_p (cfun)
? PARAM_VALUE (PARAM_SRA_MAX_SCALARIZATION_SIZE_SIZE)
: PARAM_VALUE (PARAM_SRA_MAX_SCALARIZATION_SIZE_SPEED))
* BITS_PER_UNIT;
EXECUTE_IF_SET_IN_BITMAP (candidate_bitmap, 0, i, bi)
if (bitmap_bit_p (should_scalarize_away_bitmap, i)
......@@ -2526,7 +2528,7 @@ analyze_all_variable_accesses (void)
&& type_consists_of_records_p (TREE_TYPE (var)))
{
if (tree_to_uhwi (TYPE_SIZE (TREE_TYPE (var)))
<= max_total_scalarization_size)
<= max_scalarization_size)
{
completely_scalarize_var (var);
if (dump_file && (dump_flags & TDF_DETAILS))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment