aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2006-01-16 19:35:08 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2006-01-16 19:35:08 +0000
commit183596ebacc5d5e43f77dabc23c747113705be9a (patch)
tree81b34c2198f03ac751ceca53567fb3a0777c0618
parentdcc2da4198c3727aa52e5aa3d95a844f96a60b42 (diff)
downloadgcc-183596ebacc5d5e43f77dabc23c747113705be9a.zip
gcc-183596ebacc5d5e43f77dabc23c747113705be9a.tar.gz
gcc-183596ebacc5d5e43f77dabc23c747113705be9a.tar.bz2
tree-ssa-alias.c (struct used_part): Add write_only field.
2006-01-16 Richard Guenther <rguenther@suse.de> * tree-ssa-alias.c (struct used_part): Add write_only field. (get_or_create_used_part_for): Initialize it to true. (create_overlap_variables_for): Don't create structure variables for structures that only are written to. (find_used_portions): Handle MODIFY_EXPR to track whether a structure is only written to. * gcc.dg/tree-ssa/20031015-1.c: Adjust testcase. From-SVN: r109766
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20031015-1.c6
-rw-r--r--gcc/tree-ssa-alias.c17
4 files changed, 29 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a5048a1..d19082a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2006-01-16 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-alias.c (struct used_part): Add write_only field.
+ (get_or_create_used_part_for): Initialize it to true.
+ (create_overlap_variables_for): Don't create structure variables
+ for structures that only are written to.
+ (find_used_portions): Handle MODIFY_EXPR to track whether a
+ structure is only written to.
+
2006-01-16 Kazu Hirata <kazu@codesourcery.com>
* bb-reorder.c (partition_hot_cold_basic_blocks): Make it
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 90dde06..36c42f7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2006-01-16 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/20031015-1.c: Adjust testcase.
+
2006-01-16 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR testsuite/25777
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20031015-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20031015-1.c
index 43e160d..3021656 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20031015-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20031015-1.c
@@ -13,8 +13,6 @@ main(void)
return 0;
}
-/* The V_MUST_DEF comes from the initial assignment; the V_MAY_DEF
- comes from the asm. */
-/* { dg-final { scan-tree-dump-times "V_MUST_DEF" 1 "alias1" } } */
-/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 1 "alias1" } } */
+/* The V_*_DEF comes from the initial assignment and the asm. */
+/* { dg-final { scan-tree-dump-times "_DEF" 2 "alias1" } } */
/* { dg-final { cleanup-tree-dump "alias1" } } */
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 353e7bd..5370747 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -2424,6 +2424,8 @@ typedef struct used_part
variable. Implicit uses occur when we can't tell what part we
are referencing, and have to make conservative assumptions. */
bool implicit_uses;
+ /* True if the structure is only written to or taken its address. */
+ bool write_only;
} *used_part_t;
/* An array of used_part structures, indexed by variable uid. */
@@ -2509,6 +2511,7 @@ get_or_create_used_part_for (size_t uid)
up->maxused = 0;
up->explicit_uses = false;
up->implicit_uses = false;
+ up->write_only = true;
}
return up;
@@ -2552,10 +2555,11 @@ create_overlap_variables_for (tree var)
used_part_t up;
size_t uid = DECL_UID (var);
- if (!up_lookup (uid))
+ up = up_lookup (uid);
+ if (!up
+ || up->write_only)
return;
- up = up_lookup (uid);
push_fields_onto_fieldstack (TREE_TYPE (var), &fieldstack, 0, NULL);
if (VEC_length (fieldoff_s, fieldstack) != 0)
{
@@ -2691,10 +2695,15 @@ create_overlap_variables_for (tree var)
entire structure. */
static tree
-find_used_portions (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
+find_used_portions (tree *tp, int *walk_subtrees, void *lhs_p)
{
switch (TREE_CODE (*tp))
{
+ case MODIFY_EXPR:
+ /* Recurse manually here to track whether the use is in the
+ LHS of an assignment. */
+ find_used_portions (&TREE_OPERAND (*tp, 0), walk_subtrees, tp);
+ return find_used_portions (&TREE_OPERAND (*tp, 1), walk_subtrees, NULL);
case REALPART_EXPR:
case IMAGPART_EXPR:
case COMPONENT_REF:
@@ -2723,6 +2732,8 @@ find_used_portions (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
up->explicit_uses = true;
else
up->implicit_uses = true;
+ if (!lhs_p)
+ up->write_only = false;
up_insert (uid, up);
*walk_subtrees = 0;