diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-05 02:42:06 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-05 02:42:06 +0000 |
commit | 19e1a5ccdfba4da9af78db1e8d01d7365d41c8b6 (patch) | |
tree | 1d2fdcd189ab8b9cad25924e41fb4ccae8726a08 /gcc/tree-sra.c | |
parent | 10160bcc5471b10c0b60cb984238ad058c157e2a (diff) | |
download | gcc-19e1a5ccdfba4da9af78db1e8d01d7365d41c8b6.tar.gz |
PR 21529
* params.def (PARAM_SRA_MAX_STRUCTURE_COUNT): New.
* params.h (SRA_MAX_STRUCTURE_COUNT): New.
* tree-sra.c (decide_block_copy): Use it. Disable element copy
if we'd have to instantiate too many members.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102761 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r-- | gcc/tree-sra.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 337b7977716..bd3a3c3f1f9 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1325,7 +1325,7 @@ decide_block_copy (struct sra_elt *elt) else if (host_integerp (size_tree, 1)) { unsigned HOST_WIDE_INT full_size, inst_size = 0; - unsigned int max_size; + unsigned int max_size, max_count, inst_count, full_count; /* If the sra-max-structure-size parameter is 0, then the user has not overridden the parameter and we can choose a @@ -1333,8 +1333,13 @@ decide_block_copy (struct sra_elt *elt) max_size = SRA_MAX_STRUCTURE_SIZE ? SRA_MAX_STRUCTURE_SIZE : MOVE_RATIO * UNITS_PER_WORD; + max_count = SRA_MAX_STRUCTURE_COUNT + ? SRA_MAX_STRUCTURE_COUNT + : MOVE_RATIO; full_size = tree_low_cst (size_tree, 1); + full_count = count_type_elements (elt->type); + inst_count = sum_instantiated_sizes (elt, &inst_size); /* ??? What to do here. If there are two fields, and we've only instantiated one, then instantiating the other is clearly a win. @@ -1344,15 +1349,12 @@ decide_block_copy (struct sra_elt *elt) /* If the structure is small, and we've made copies, go ahead and instantiate, hoping that the copies will go away. */ if (full_size <= max_size + && (full_count - inst_count) <= max_count && elt->n_copies > elt->n_uses) use_block_copy = false; - else - { - sum_instantiated_sizes (elt, &inst_size); - - if (inst_size * 100 >= full_size * SRA_FIELD_STRUCTURE_RATIO) - use_block_copy = false; - } + else if (inst_count * 100 >= full_count * SRA_FIELD_STRUCTURE_RATIO + && inst_size * 100 >= full_size * SRA_FIELD_STRUCTURE_RATIO) + use_block_copy = false; /* In order to avoid block copy, we have to be able to instantiate all elements of the type. See if this is possible. */ |