]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-ssa-structalias.c (get_constraint_exp_from_ssa_var): Only fall back to saying...
authorDaniel Berlin <dberlin@dberlin.org>
Tue, 5 Jul 2005 15:31:17 +0000 (15:31 +0000)
committerDaniel Berlin <dberlin@gcc.gnu.org>
Tue, 5 Jul 2005 15:31:17 +0000 (15:31 +0000)
2005-07-04  Daniel Berlin  <dberlin@dberlin.org>

* tree-ssa-structalias.c (get_constraint_exp_from_ssa_var):
Only fall back to saying it points to readonly memory if
we can't do better.

From-SVN: r101625

gcc/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pta-fp.c [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index 87268cdb6fa54e73dcdcf7d805a256c2bfbfce51..32e6c58104cc074067bdb6081dc8282395f49554 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-04  Daniel Berlin  <dberlin@dberlin.org>
+
+       * tree-ssa-structalias.c (get_constraint_exp_from_ssa_var):
+       Only fall back to saying it points to readonly memory if
+       we can't do better.
+
 2005-07-05  Kazuhiro Inaoka  <inaoka.kazuhiro@renesas.com>
 
        * config/m32r/m32r-protos.h: Remove m32r_finalize_pic.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-fp.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-fp.c
new file mode 100644 (file)
index 0000000..e835399
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do compile } */ 
+/* { dg-options "-O2 -fdump-tree-pta1" } */
+extern double cos (double);
+extern double sin (double);
+double f(double a)
+{
+  double b;
+  double c,d;
+  double (*fp) (double);
+  if (a < 2.0)
+    {
+      fp = sin;
+      c = fp (a);
+    }
+  else
+    {
+      c = 1.0; 
+      fp = cos;
+    }
+  d = fp (a);
+  return d + c;
+}
+/* The points-to set of the final function pointer should be "sin cos" */
+
+/* { dg-final { scan-tree-dump-times "sin cos" 1 "pta1"} } */
+/* { dg-final { cleanup-tree-dump "pta1" } } */
index f48bcb24678e71bac7b10dedc61107e19c6645b7..96071d62b974699f8fba92d86e90e60cf8c25659 100644 (file)
@@ -1849,13 +1849,14 @@ get_constraint_exp_from_ssa_var (tree t)
 
   cexpr.type = SCALAR;
   
-  if (TREE_READONLY (t))
+  cexpr.var = get_id_for_tree (t);
+  /* If we determine the result is "anything", and we know this is readonly,
+     say it points to readonly memory instead.  */
+  if (cexpr.var == anything_id && TREE_READONLY (t))
     {
       cexpr.type = ADDRESSOF;
       cexpr.var = readonly_id;
     }
-  else
-    cexpr.var = get_id_for_tree (t);    
     
   cexpr.offset = 0;
   return cexpr;