aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-20 03:59:45 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-20 03:59:45 +0000
commite20e5153e2947ecd85323712b1bf35a7b2e6ccc3 (patch)
tree8970f20eac2ad2aaeb5016a190118c6ddbf2864a /gcc/testsuite
parentec517cc92e1c4a6b84843d8bbaa91810e015f1c5 (diff)
PR optimization/14643
* tree-ssa-alias.c (group_aliases_into): Don't add a variable to its own may-alias set. (create_alias_map_for): New. (setup_pointers_and_addressables): Call it. Fix allocation of AI->ADDRESSABLE_VARS and AI->POINTERS. If there are no addressable variables and more than one dereferenced pointers, add type tags to the ADDRESSABLE_VARS array. (get_tmt_for): Add comment about using alias set equality when checking for existing tags. testsuite/ChangeLog.tree-ssa: * gcc.dg/tree-ssa/20040319-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@79728 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog.tree-ssa5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20040319-1.c25
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog.tree-ssa b/gcc/testsuite/ChangeLog.tree-ssa
index 8390e4c2af7..28dd2d37ece 100644
--- a/gcc/testsuite/ChangeLog.tree-ssa
+++ b/gcc/testsuite/ChangeLog.tree-ssa
@@ -1,3 +1,8 @@
+2004-03-19 Diego Novillo <dnovillo@redhat.com>
+
+ PR optimization/14643
+ * gcc.dg/tree-ssa/20040319-1.c: New test.
+
2004-03-19 Jeff Law <law@redhat.com>
* gcc.c-torture/execute/20040319-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040319-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040319-1.c
new file mode 100644
index 00000000000..571c2aeabad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20040319-1.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+/* Test derived from PR 14643. When a function has no addressable
+ variables but 2 or more pointers have conflicting memory tags, they
+ were not being processed by the type based alias analyzer,
+ resulting in optimizations removing a non-redundant load. */
+
+struct bar { int count; int *arr;};
+
+void foo (struct bar *b)
+{
+ b->count = 0;
+ *(b->arr) = 2;
+ if (b->count == 0) /* b->count can't be assumed to be 0 here. */
+ abort ();
+}
+
+main ()
+{
+ struct bar x;
+ x.arr = &x.count;
+ foo (&x);
+ return 0;
+}