From: Daniel Berlin Date: Tue, 5 Jul 2005 15:31:17 +0000 (+0000) Subject: tree-ssa-structalias.c (get_constraint_exp_from_ssa_var): Only fall back to saying... X-Git-Tag: misc/cutover-cvs2svn~1929 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=47bcb538b497203e13bcf965302e5af682f2bf12;p=thirdparty%2Fgcc.git 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 * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87268cdb6fa5..32e6c58104cc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-07-04 Daniel Berlin + + * 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 * 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 000000000000..e835399b19df --- /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 f48bcb24678e..96071d62b974 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;