diff options
author | Daniel Berlin <dberlin@dberlin.org> | 2005-07-05 15:31:17 +0000 |
---|---|---|
committer | Daniel Berlin <dberlin@gcc.gnu.org> | 2005-07-05 15:31:17 +0000 |
commit | 47bcb538b497203e13bcf965302e5af682f2bf12 (patch) | |
tree | 88871fd1f2075db99ebe543b01fa76b3fb6dc63c /gcc | |
parent | cdc9bfe6aad8daf8b31b99d138ea91184b0a03ab (diff) | |
download | gcc-47bcb538b497203e13bcf965302e5af682f2bf12.zip gcc-47bcb538b497203e13bcf965302e5af682f2bf12.tar.gz gcc-47bcb538b497203e13bcf965302e5af682f2bf12.tar.bz2 |
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-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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pta-fp.c | 26 | ||||
-rw-r--r-- | gcc/tree-ssa-structalias.c | 7 |
3 files changed, 36 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87268cd..32e6c58 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 index 0000000..e835399 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-fp.c @@ -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" } } */ diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index f48bcb2..96071d6 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -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; |