aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-sra.c
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2006-11-20 20:29:10 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2006-11-20 12:29:10 -0800
commit903ff2758bdad932eee6ae84539361c18e6c45e9 (patch)
tree1853b5cc64ec5dcfeca725acbdb5d00dda2bf7f2 /gcc/tree-sra.c
parentd7043acd94f8d8d6c93465ca4a98d07e5a2fb163 (diff)
downloadgcc-903ff2758bdad932eee6ae84539361c18e6c45e9.zip
gcc-903ff2758bdad932eee6ae84539361c18e6c45e9.tar.gz
gcc-903ff2758bdad932eee6ae84539361c18e6c45e9.tar.bz2
re PR target/25500 (SSE2 vectorized code is slower on 4.x.x than previous)
2006-11-20 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/25500 * tree-sra.c (single_scalar_field_in_record_p): New function. (decide_block_copy): Use it. 2006-11-20 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/25500 * gcc.dg/tree-ssa/sra-4.c: New testcase. From-SVN: r119026
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r--gcc/tree-sra.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 80c4ca7..a5ed161 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1351,6 +1351,32 @@ instantiate_missing_elements (struct sra_elt *elt)
}
}
+/* Return true if there is only one non aggregate field in the record, TYPE.
+ Return false otherwise. */
+
+static bool
+single_scalar_field_in_record_p (tree type)
+{
+ int num_fields = 0;
+ tree field;
+ if (TREE_CODE (type) != RECORD_TYPE)
+ return false;
+
+ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
+ if (TREE_CODE (field) == FIELD_DECL)
+ {
+ num_fields++;
+
+ if (num_fields == 2)
+ return false;
+
+ if (AGGREGATE_TYPE_P (TREE_TYPE (field)))
+ return false;
+ }
+
+ return true;
+}
+
/* Make one pass across an element tree deciding whether to perform block
or element copies. If we decide on element copies, instantiate all
elements. Return true if there are any instantiated sub-elements. */
@@ -1430,6 +1456,10 @@ decide_block_copy (struct sra_elt *elt)
full_count = count_type_elements (elt->type, false);
inst_count = sum_instantiated_sizes (elt, &inst_size);
+ /* If there is only one scalar field in the record, don't block copy. */
+ if (single_scalar_field_in_record_p (elt->type))
+ use_block_copy = false;
+
/* ??? What to do here. If there are two fields, and we've only
instantiated one, then instantiating the other is clearly a win.
If there are a large number of fields then the size of the copy