diff options
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r-- | gcc/tree-sra.c | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index db490b2..866cff0 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -4453,7 +4453,7 @@ static struct access * splice_param_accesses (tree parm, bool *ro_grp) { int i, j, access_count, group_count; - int agg_size, total_size = 0; + int total_size = 0; struct access *access, *res, **prev_acc_ptr = &res; vec<access_p> *access_vec; @@ -4520,13 +4520,6 @@ splice_param_accesses (tree parm, bool *ro_grp) i = j; } - if (POINTER_TYPE_P (TREE_TYPE (parm))) - agg_size = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (TREE_TYPE (parm)))); - else - agg_size = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (parm))); - if (total_size >= agg_size) - return NULL; - gcc_assert (group_count > 0); return res; } @@ -4537,7 +4530,7 @@ splice_param_accesses (tree parm, bool *ro_grp) static int decide_one_param_reduction (struct access *repr) { - int total_size, cur_parm_size, agg_size, new_param_count, parm_size_limit; + HOST_WIDE_INT total_size, cur_parm_size; bool by_ref; tree parm; @@ -4546,15 +4539,9 @@ decide_one_param_reduction (struct access *repr) gcc_assert (cur_parm_size > 0); if (POINTER_TYPE_P (TREE_TYPE (parm))) - { - by_ref = true; - agg_size = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (TREE_TYPE (parm)))); - } + by_ref = true; else - { - by_ref = false; - agg_size = cur_parm_size; - } + by_ref = false; if (dump_file) { @@ -4567,7 +4554,7 @@ decide_one_param_reduction (struct access *repr) } total_size = 0; - new_param_count = 0; + int new_param_count = 0; for (; repr; repr = repr->next_grp) { @@ -4595,22 +4582,28 @@ decide_one_param_reduction (struct access *repr) gcc_assert (new_param_count > 0); - if (optimize_function_for_size_p (cfun)) - parm_size_limit = cur_parm_size; - else - parm_size_limit = (PARAM_VALUE (PARAM_IPA_SRA_PTR_GROWTH_FACTOR) - * cur_parm_size); - - if (total_size < agg_size - && total_size <= parm_size_limit) + if (!by_ref) { - if (dump_file) - fprintf (dump_file, " ....will be split into %i components\n", - new_param_count); - return new_param_count; + if (total_size >= cur_parm_size) + return 0; } else - return 0; + { + int parm_num_limit; + if (optimize_function_for_size_p (cfun)) + parm_num_limit = 1; + else + parm_num_limit = PARAM_VALUE (PARAM_IPA_SRA_PTR_GROWTH_FACTOR); + + if (new_param_count > parm_num_limit + || total_size > (parm_num_limit * cur_parm_size)) + return 0; + } + + if (dump_file) + fprintf (dump_file, " ....will be split into %i components\n", + new_param_count); + return new_param_count; } /* The order of the following enums is important, we need to do extra work for |