From e20e5153e2947ecd85323712b1bf35a7b2e6ccc3 Mon Sep 17 00:00:00 2001 From: dnovillo Date: Sat, 20 Mar 2004 03:59:45 +0000 Subject: 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 --- gcc/testsuite/ChangeLog.tree-ssa | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/20040319-1.c | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/20040319-1.c (limited to 'gcc/testsuite') 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 + + PR optimization/14643 + * gcc.dg/tree-ssa/20040319-1.c: New test. + 2004-03-19 Jeff Law * 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; +} -- cgit v1.2.3