diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cbcd386e06bb..ef7e845554fd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2009-05-25 Richard Guenther + + * tree-ssa-alias.h (dump_points_to_solution): Declare. + * tree-inline.c (expand_call_inline): Reset the escaped and + callused solutions. + * tree-ssa-structalias.c (pass_build_ealias): New. + * tree-pass.h (pass_build_ealias): Declare. + * passes.c (init_optimization_passes): Add PTA during + early optimizations. + * tree-ssa-alias.c (dump_alias_info): Dump the ESCAPED + and CALLUSED solutions. + (dump_points_to_solution): New function, split out from ... + (dump_points_to_info_for): ... here. + * tree-parloops.c (parallelize_loops): Reset the escaped and + callused solutions. + 2009-05-25 Rainer Orth PR bootstrap/40027 diff --git a/gcc/passes.c b/gcc/passes.c index 28838b57a0e0..2408668c0830 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -554,7 +554,11 @@ init_optimization_passes (void) NEXT_PASS (pass_rename_ssa_copies); NEXT_PASS (pass_ccp); NEXT_PASS (pass_forwprop); - NEXT_PASS (pass_update_address_taken); + /* pass_build_ealias is a dummy pass that ensures that we + execute TODO_rebuild_alias at this point. Re-building + alias information also rewrites no longer addressed + locals into SSA form if possible. */ + NEXT_PASS (pass_build_ealias); NEXT_PASS (pass_sra_early); NEXT_PASS (pass_copy_prop); NEXT_PASS (pass_merge_phi); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a7231036dee..097317c4f15f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-05-25 Richard Guenther + + * gcc.dg/tree-ssa/ssa-fre-14.c: Adjust. + * gcc.dg/tree-ssa/ssa-fre-15.c: Likewise. + 2009-05-25 Ira Rosen PR tree-optimization/40238 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c index 24b58ee941a3..81b82fe48803 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c @@ -8,6 +8,7 @@ struct Foo void *data; double size; }; +void bar(double *); void foo(double (*q)[4]) { struct Foo tmp1; @@ -23,6 +24,7 @@ void foo(double (*q)[4]) this store to tmp1 here. */ tmp1.size -= 1.0; } + bar(a); } /* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c index a557f27f319b..d24cd1e4c38b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c @@ -8,6 +8,7 @@ struct Foo void *data; double size; }; +void bar(double *); void foo(double (*q)[4]) { struct Foo tmp1; @@ -22,6 +23,7 @@ void foo(double (*q)[4]) this store to tmp1 here. */ tmp1.size -= 1.0; } + bar(a); } /* { dg-final { scan-tree-dump "Replaced" "fre" } } */ diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 1b53288bca34..fd04f6f0c90c 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3451,6 +3451,13 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id) duplicate our body before altering anything. */ copy_body (id, bb->count, bb->frequency, bb, return_block); + /* Reset the escaped and callused solutions. */ + if (cfun->gimple_df) + { + pt_solution_reset (&cfun->gimple_df->escaped); + pt_solution_reset (&cfun->gimple_df->callused); + } + /* Clean up. */ pointer_map_destroy (id->decl_map); id->decl_map = st; diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 4e9b102973a1..2ec26196bc13 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -1886,6 +1886,16 @@ parallelize_loops (void) free_stmt_vec_info_vec (); htab_delete (reduction_list); + + /* Parallelization will cause new function calls to be inserted through + which local variables will escape. Reset the points-to solutions + for ESCAPED and CALLUSED. */ + if (changed) + { + pt_solution_reset (&cfun->gimple_df->escaped); + pt_solution_reset (&cfun->gimple_df->callused); + } + return changed; } diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index abb4bd11caa3..f300d0eea962 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -350,6 +350,7 @@ extern struct gimple_opt_pass pass_ccp; extern struct gimple_opt_pass pass_phi_only_cprop; extern struct gimple_opt_pass pass_build_ssa; extern struct gimple_opt_pass pass_build_alias; +extern struct gimple_opt_pass pass_build_ealias; extern struct gimple_opt_pass pass_dominator; extern struct gimple_opt_pass pass_dce; extern struct gimple_opt_pass pass_dce_loop; diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index ef360ea87d5d..5be39f003983 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -330,7 +330,14 @@ dump_alias_info (FILE *file) dump_variable (file, var); } - fprintf (file, "\n\nFlow-insensitive points-to information for %s\n\n", funcname); + fprintf (file, "\nCall clobber information\n"); + + fprintf (file, "\nESCAPED"); + dump_points_to_solution (file, &cfun->gimple_df->escaped); + fprintf (file, "\nCALLUSED"); + dump_points_to_solution (file, &cfun->gimple_df->callused); + + fprintf (file, "\n\nFlow-insensitive points-to information\n\n"); for (i = 1; i < num_ssa_names; i++) { @@ -380,6 +387,32 @@ get_ptr_info (tree t) return pi; } +/* Dump the points-to set *PT into FILE. */ + +void +dump_points_to_solution (FILE *file, struct pt_solution *pt) +{ + if (pt->anything) + fprintf (file, ", points-to anything"); + + if (pt->nonlocal) + fprintf (file, ", points-to non-local"); + + if (pt->escaped) + fprintf (file, ", points-to escaped"); + + if (pt->null) + fprintf (file, ", points-to NULL"); + + if (pt->vars) + { + fprintf (file, ", points-to vars: "); + dump_decl_set (file, pt->vars); + if (pt->vars_contains_global) + fprintf (file, " (includes global vars)"); + } +} + /* Dump points-to information for SSA_NAME PTR into FILE. */ void @@ -390,27 +423,9 @@ dump_points_to_info_for (FILE *file, tree ptr) print_generic_expr (file, ptr, dump_flags); if (pi) - { - if (pi->pt.anything) - fprintf (file, ", points-to anything"); - - if (pi->pt.nonlocal) - fprintf (file, ", points-to non-local"); - - if (pi->pt.escaped) - fprintf (file, ", points-to escaped"); - - if (pi->pt.null) - fprintf (file, ", points-to NULL"); - - if (pi->pt.vars) - { - fprintf (file, ", points-to vars: "); - dump_decl_set (file, pi->pt.vars); - if (pi->pt.vars_contains_global) - fprintf (file, " (includes global vars)"); - } - } + dump_points_to_solution (file, &pi->pt); + else + fprintf (file, ", points-to anything"); fprintf (file, "\n"); } diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h index a7ffcaa683cb..d4d736d1c7b0 100644 --- a/gcc/tree-ssa-alias.h +++ b/gcc/tree-ssa-alias.h @@ -90,6 +90,7 @@ extern unsigned int walk_aliased_vdefs (tree, tree, extern struct ptr_info_def *get_ptr_info (tree); extern void dump_alias_info (FILE *); extern void debug_alias_info (void); +extern void dump_points_to_solution (FILE *, struct pt_solution *); extern void dump_points_to_info_for (FILE *, tree); extern void debug_points_to_info_for (tree); extern void dump_alias_stats (FILE *); diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index aa944364e48c..1fdbab472184 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -5436,6 +5436,28 @@ struct gimple_opt_pass pass_build_alias = } }; +/* A dummy pass to cause points-to information to be computed via + TODO_rebuild_alias. */ + +struct gimple_opt_pass pass_build_ealias = +{ + { + GIMPLE_PASS, + "ealias", /* name */ + gate_tree_pta, /* gate */ + NULL, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_NONE, /* tv_id */ + PROP_cfg | PROP_ssa, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_rebuild_alias | TODO_dump_func /* todo_flags_finish */ + } +}; + /* Return true if we should execute IPA PTA. */ static bool