pointer-reference-alias.C: New test.
authorAndrew Pinski <apinski@apple.com>
Wed, 15 Sep 2004 01:18:01 +0000 (01:18 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Wed, 15 Sep 2004 01:18:01 +0000 (18:18 -0700)
2004-09-14  Andrew Pinski  <apinski@apple.com>

        * g++.dg/tree-ssa/pointer-reference-alias.C: New test.

2004-09-14  Andrew Pinski  <apinski@apple.com>

        * 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
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tree-ssa/pointer-reference-alias.C [new file with mode: 0644]
gcc/tree-ssa-copy.c

index 2ce328f08b6e2a21bbd04f6dcb0b09f99ccc1906..91006595813c8d2f84b3f39af6b8c5916d750449 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-14  Andrew Pinski  <apinski@apple.com>
+
+       * 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  <roger@eyesopen.com>
 
        PR rtl-optimization/9771
index a8f7e5d393e62a2a0d731d7606e161e1594226fd..78de08e73e3434afae789b7c5f87004212807ad0 100644 (file)
@@ -1,3 +1,7 @@
+2004-09-14  Andrew Pinski  <apinski@apple.com>
+
+       * g++.dg/tree-ssa/pointer-reference-alias.C: New test.
+
 2004-09-14  Roger Sayle  <roger@eyesopen.com>
 
        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 (file)
index 0000000..028240b
--- /dev/null
@@ -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"} } */
+
index 7b27c68b1bd5c7a84c61627c691199efaa5d32f3..611bae77bad736888c3eeb7ddb2c761018c30c15 100644 (file)
@@ -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;
     }