aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-sra.c
diff options
context:
space:
mode:
authorJames Greenhalgh <james.greenhalgh@arm.com>2015-07-03 09:25:54 +0000
committerJames Greenhalgh <jgreenhalgh@gcc.gnu.org>2015-07-03 09:25:54 +0000
commit7bd6f24be2ff057f6e59788a497e206e46e47735 (patch)
tree41d9cf4bc629104c82fe2278fa51e0576bead17e /gcc/tree-sra.c
parentbab73f11b8eb01e137ac86ca232c3058175de877 (diff)
downloadgcc-7bd6f24be2ff057f6e59788a497e206e46e47735.zip
gcc-7bd6f24be2ff057f6e59788a497e206e46e47735.tar.gz
gcc-7bd6f24be2ff057f6e59788a497e206e46e47735.tar.bz2
[Patch SRA] Fix PR66119 by calling get_move_ratio in SRA
gcc/ PR tree-optimization/66119 * toplev.c (process_options): Don't set up default values for the sra_max_scalarization_size_{speed,size} parameters. * tree-sra (analyze_all_variable_accesses): If no values have been set for the sra_max_scalarization_size_{speed,size} parameters, call get_move_ratio to get target defaults. gcc/testsuite/ PR tree-optimization/66119 * g++.dg/opt/pr66119.C: New. From-SVN: r225369
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r--gcc/tree-sra.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 7f242f7..e648061 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2545,11 +2545,20 @@ analyze_all_variable_accesses (void)
bitmap tmp = BITMAP_ALLOC (NULL);
bitmap_iterator bi;
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;
+ bool optimize_speed_p = !optimize_function_for_size_p (cfun);
+
+ enum compiler_param param = optimize_speed_p
+ ? PARAM_SRA_MAX_SCALARIZATION_SIZE_SPEED
+ : PARAM_SRA_MAX_SCALARIZATION_SIZE_SIZE;
+
+ /* If the user didn't set PARAM_SRA_MAX_SCALARIZATION_SIZE_<...>,
+ fall back to a target default. */
+ unsigned HOST_WIDE_INT max_scalarization_size
+ = global_options_set.x_param_values[param]
+ ? PARAM_VALUE (param)
+ : get_move_ratio (optimize_speed_p) * UNITS_PER_WORD;
+
+ max_scalarization_size *= BITS_PER_UNIT;
EXECUTE_IF_SET_IN_BITMAP (candidate_bitmap, 0, i, bi)
if (bitmap_bit_p (should_scalarize_away_bitmap, i)