aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-structalias.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-06-16 12:31:49 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-06-16 12:31:49 +0000
commitde70bb20ba3864deca9c9cba9edf646ae1d8a226 (patch)
tree5a544b381b9b4cb81b15ed5e414068721bdaae3c /gcc/tree-ssa-structalias.c
parentdaa0eeb8ab04b67053944c8990643e1efe8c913b (diff)
downloadgcc-de70bb20ba3864deca9c9cba9edf646ae1d8a226.zip
gcc-de70bb20ba3864deca9c9cba9edf646ae1d8a226.tar.gz
gcc-de70bb20ba3864deca9c9cba9edf646ae1d8a226.tar.bz2
tree-ssa-structalias.c (do_ds_constraint): Stores in global variables add them to ESCAPED.
2009-06-16 Richard Guenther <rguenther@suse.de> * tree-ssa-structalias.c (do_ds_constraint): Stores in global variables add them to ESCAPED. (find_func_aliases): Do not make all indirectly stored values escaped. * gcc.dg/tree-ssa/pta-escape-1.c: New testcase. * gcc.dg/tree-ssa/pta-escape-2.c: Likewise. * gcc.dg/tree-ssa/pta-escape-3.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-27.c: Likewise. From-SVN: r148525
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r--gcc/tree-ssa-structalias.c69
1 files changed, 36 insertions, 33 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 7c95de4..62a1e43 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -1664,6 +1664,19 @@ do_ds_constraint (constraint_t c, bitmap delta)
unsigned int t;
HOST_WIDE_INT fieldoffset = v->offset + loff;
+ /* If v is a NONLOCAL then this is an escape point. */
+ if (j == nonlocal_id)
+ {
+ t = find (escaped_id);
+ if (add_graph_edge (graph, t, rhs)
+ && bitmap_ior_into (get_varinfo (t)->solution, sol)
+ && !TEST_BIT (changed, t))
+ {
+ SET_BIT (changed, t);
+ changed_count++;
+ }
+ }
+
if (v->is_special_var)
continue;
@@ -1680,18 +1693,24 @@ do_ds_constraint (constraint_t c, bitmap delta)
if (v->may_have_pointers)
{
t = find (v->id);
- if (add_graph_edge (graph, t, rhs))
+ if (add_graph_edge (graph, t, rhs)
+ && bitmap_ior_into (get_varinfo (t)->solution, sol)
+ && !TEST_BIT (changed, t))
{
- if (bitmap_ior_into (get_varinfo (t)->solution, sol))
- {
- if (t == rhs)
- sol = get_varinfo (rhs)->solution;
- if (!TEST_BIT (changed, t))
- {
- SET_BIT (changed, t);
- changed_count++;
- }
- }
+ SET_BIT (changed, t);
+ changed_count++;
+ }
+ }
+ /* If v is a global variable then this is an escape point. */
+ if (is_global_var (v->decl))
+ {
+ t = find (escaped_id);
+ if (add_graph_edge (graph, t, rhs)
+ && bitmap_ior_into (get_varinfo (t)->solution, sol)
+ && !TEST_BIT (changed, t))
+ {
+ SET_BIT (changed, t);
+ changed_count++;
}
}
@@ -3734,31 +3753,15 @@ find_func_aliases (gimple origt)
process_constraint (new_constraint (*c, *c2));
}
}
+ /* If there is a store to a global variable the rhs escapes. */
+ if ((lhsop = get_base_address (lhsop)) != NULL_TREE
+ && DECL_P (lhsop)
+ && is_global_var (lhsop))
+ make_escape_constraint (rhsop);
}
stmt_escape_type = is_escape_site (t);
- if (stmt_escape_type == ESCAPE_STORED_IN_GLOBAL)
- {
- gcc_assert (is_gimple_assign (t));
- if (gimple_assign_rhs_code (t) == ADDR_EXPR)
- {
- tree rhs = gimple_assign_rhs1 (t);
- tree base = get_base_address (TREE_OPERAND (rhs, 0));
- if (base
- && (!DECL_P (base)
- || !is_global_var (base)))
- make_escape_constraint (rhs);
- }
- else if (get_gimple_rhs_class (gimple_assign_rhs_code (t))
- == GIMPLE_SINGLE_RHS)
- {
- if (could_have_pointers (gimple_assign_rhs1 (t)))
- make_escape_constraint (gimple_assign_rhs1 (t));
- }
- else
- gcc_unreachable ();
- }
- else if (stmt_escape_type == ESCAPE_BAD_CAST)
+ if (stmt_escape_type == ESCAPE_BAD_CAST)
{
gcc_assert (is_gimple_assign (t));
gcc_assert (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (t))