From 5ffcd77909762ca7091b915aef658f28c635ed36 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Wed, 15 Sep 2004 01:18:01 +0000 Subject: [PATCH] pointer-reference-alias.C: New test. 2004-09-14 Andrew Pinski * g++.dg/tree-ssa/pointer-reference-alias.C: New test. 2004-09-14 Andrew Pinski * tree-ssa-copy.c (may_propagate_copy): Don't check the aliasing sets of the pointers but the aliasing sets of what they point to. From-SVN: r87527 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 4 ++++ .../g++.dg/tree-ssa/pointer-reference-alias.C | 13 +++++++++++++ gcc/tree-ssa-copy.c | 4 ++-- 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/tree-ssa/pointer-reference-alias.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2ce328f08b6..91006595813 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-09-14 Andrew Pinski + + * tree-ssa-copy.c (may_propagate_copy): Don't check the aliasing + sets of the pointers but the aliasing sets of what they point to. + 2004-09-14 Roger Sayle PR rtl-optimization/9771 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a8f7e5d393e..78de08e73e3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-09-14 Andrew Pinski + + * g++.dg/tree-ssa/pointer-reference-alias.C: New test. + 2004-09-14 Roger Sayle PR rtl-optimization/9771 diff --git a/gcc/testsuite/g++.dg/tree-ssa/pointer-reference-alias.C b/gcc/testsuite/g++.dg/tree-ssa/pointer-reference-alias.C new file mode 100644 index 00000000000..028240b3908 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pointer-reference-alias.C @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-vars" } */ + +int f(int *a) +{ + int &b = *a; + b = 0; + return *a; +} + +/* There should be only one dereferencing of a. */ +/* { dg-final { scan-tree-dump-times "\\*a" 1 "vars"} } */ + diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c index 7b27c68b1bd..611bae77bad 100644 --- a/gcc/tree-ssa-copy.c +++ b/gcc/tree-ssa-copy.c @@ -112,8 +112,8 @@ may_propagate_copy (tree dest, tree orig) return false; else if (!lang_hooks.types_compatible_p (type_d, type_o)) return false; - else if (!alias_sets_conflict_p (get_alias_set (type_d), - get_alias_set (type_o))) + else if (!alias_sets_conflict_p (get_alias_set (TREE_TYPE (type_d)), + get_alias_set (TREE_TYPE (type_o)))) return false; } -- 2.30.2