diff options
author | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-03-20 03:59:45 +0000 |
---|---|---|
committer | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-03-20 03:59:45 +0000 |
commit | e20e5153e2947ecd85323712b1bf35a7b2e6ccc3 (patch) | |
tree | 8970f20eac2ad2aaeb5016a190118c6ddbf2864a /gcc/testsuite/gcc.dg/tree-ssa/20040319-1.c | |
parent | ec517cc92e1c4a6b84843d8bbaa91810e015f1c5 (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/gcc.dg/tree-ssa/20040319-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/20040319-1.c | 25 |
1 files changed, 25 insertions, 0 deletions
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; +} |