diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 68e0f335975..47548957e2c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2009-07-02 Richard Guenther + + * tree-ssa-live.c (remove_unused_locals): Do not remove + heap variables. + * tree-ssa-structalias.c (handle_lhs_call): Delay setting + of DECL_EXTERNAL for HEAP variables. + (compute_points_to_sets): Set DECL_EXTERNAL for escaped + HEAP variables. Do not adjust RESTRICT vars. + (find_what_var_points_to): Nobody cares if something + points to READONLY. + 2009-07-02 Ben Elliston * unwind-dw2-fde-glibc.c (_Unwind_IteratePhdrCallback): Move diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index a710c65d3b4..d4166944e97 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -795,6 +795,7 @@ remove_unused_locals (void) && TREE_CODE (t) != PARM_DECL && TREE_CODE (t) != RESULT_DECL && !(ann = var_ann (t))->used + && !ann->is_heapvar && !TREE_ADDRESSABLE (t)) remove_referenced_var (t); remove_unused_scope_block_p (DECL_INITIAL (current_function_decl)); diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 84edf00e2b2..95ca88296d3 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -3475,6 +3475,7 @@ handle_lhs_call (tree lhs, int flags, VEC(ce_s, heap) *rhsc) vi = make_constraint_from_heapvar (get_vi_for_tree (lhs), "HEAP"); /* We delay marking allocated storage global until we know if it escapes. */ + DECL_EXTERNAL (vi->decl) = 0; vi->is_global_var = 0; } else if (VEC_length (ce_s, rhsc) > 0) @@ -4785,8 +4786,10 @@ find_what_var_points_to (varinfo_t vi, struct pt_solution *pt) else if (vi->is_heap_var) /* We represent heapvars in the points-to set properly. */ ; + else if (vi->id == readonly_id) + /* Nobody cares. */ + ; else if (vi->id == anything_id - || vi->id == readonly_id || vi->id == integer_id) pt->anything = 1; } @@ -5460,9 +5463,10 @@ compute_points_to_sets (void) /* Mark escaped HEAP variables as global. */ for (i = 0; VEC_iterate (varinfo_t, varmap, i, vi); ++i) if (vi->is_heap_var + && !vi->is_restrict_var && !vi->is_global_var) - vi->is_global_var = pt_solution_includes (&cfun->gimple_df->escaped, - vi->decl); + DECL_EXTERNAL (vi->decl) = vi->is_global_var + = pt_solution_includes (&cfun->gimple_df->escaped, vi->decl); /* Compute the points-to sets for pointer SSA_NAMEs. */ for (i = 0; i < num_ssa_names; ++i)