Index: tree-pass.h =================================================================== --- tree-pass.h (revision 127319) +++ tree-pass.h (working copy) @@ -149,12 +149,11 @@ struct dump_file_info #define PROP_gimple_leh (1 << 2) /* lowered eh */ #define PROP_cfg (1 << 3) #define PROP_referenced_vars (1 << 4) -#define PROP_pta (1 << 5) -#define PROP_ssa (1 << 6) -#define PROP_no_crit_edges (1 << 7) -#define PROP_rtl (1 << 8) -#define PROP_alias (1 << 9) -#define PROP_gimple_lomp (1 << 10) /* lowered OpenMP directives */ +#define PROP_ssa (1 << 5) +#define PROP_no_crit_edges (1 << 6) +#define PROP_rtl (1 << 7) +#define PROP_alias (1 << 8) +#define PROP_gimple_lomp (1 << 9) /* lowered OpenMP directives */ #define PROP_trees \ (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp) @@ -228,6 +227,9 @@ struct dump_file_info /* Internally used for the first instance of a pass. */ #define TODO_mark_first_instance (1 << 18) +/* Rebuild aliasing info. */ +#define TODO_rebuild_alias (1 << 19) + #define TODO_update_ssa_any \ (TODO_update_ssa \ | TODO_update_ssa_no_phi \ @@ -278,7 +280,6 @@ extern struct tree_opt_pass pass_dce; extern struct tree_opt_pass pass_dce_loop; extern struct tree_opt_pass pass_cd_dce; extern struct tree_opt_pass pass_merge_phi; -extern struct tree_opt_pass pass_may_alias; extern struct tree_opt_pass pass_split_crit_edges; extern struct tree_opt_pass pass_pre; extern struct tree_opt_pass pass_profile; Index: tree-ssa-ccp.c =================================================================== --- tree-ssa-ccp.c (revision 127319) +++ tree-ssa-ccp.c (working copy) @@ -2640,6 +2640,8 @@ execute_fold_all_builtins (void) { bool cfg_changed = false; basic_block bb; + unsigned int todoflags = 0; + FOR_EACH_BB (bb) { block_stmt_iterator i; @@ -2697,6 +2699,7 @@ execute_fold_all_builtins (void) { bool ok = set_rhs (stmtp, result); gcc_assert (ok); + todoflags |= TODO_rebuild_alias; } } @@ -2728,9 +2731,12 @@ execute_fold_all_builtins (void) bsi_next (&i); } } - + /* Delete unreachable blocks. */ - return cfg_changed ? TODO_cleanup_cfg : 0; + if (cfg_changed) + todoflags |= TODO_cleanup_cfg; + + return todoflags; } Index: tree-ssa-alias.c =================================================================== --- tree-ssa-alias.c (revision 127319) +++ tree-ssa-alias.c (working copy) @@ -1634,10 +1634,12 @@ done: grouped to avoid severe compile-time slow downs and memory consumption. See compute_memory_partitions. */ -static unsigned int +unsigned int compute_may_aliases (void) { struct alias_info *ai; + + timevar_push (TV_TREE_MAY_ALIAS); memset (&alias_stats, 0, sizeof (alias_stats)); @@ -1731,33 +1733,15 @@ compute_may_aliases (void) /* Deallocate memory used by aliasing data structures. */ delete_alias_info (ai); + + if (need_ssa_update_p ()) + update_ssa (TODO_update_ssa); + + timevar_pop (TV_TREE_MAY_ALIAS); return 0; } - -struct tree_opt_pass pass_may_alias = -{ - "alias", /* name */ - NULL, /* gate */ - compute_may_aliases, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_TREE_MAY_ALIAS, /* tv_id */ - PROP_cfg | PROP_ssa, /* properties_required */ - PROP_alias, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - TODO_dump_func - | TODO_update_ssa - | TODO_ggc_collect - | TODO_verify_ssa - | TODO_verify_stmts, /* todo_flags_finish */ - 0 /* letter */ -}; - - /* Data structure used to count the number of dereferences to PTR inside an expression. */ struct count_ptr_d @@ -4028,7 +4012,7 @@ create_structure_vars (void) } } - return 0; + return TODO_rebuild_alias; } static bool Index: tree-ssa-pre.c =================================================================== --- tree-ssa-pre.c (revision 127319) +++ tree-ssa-pre.c (working copy) @@ -3981,7 +3981,7 @@ static unsigned int do_pre (void) { execute_pre (false); - return 0; + return TODO_rebuild_alias; } static bool Index: tree-sra.c =================================================================== --- tree-sra.c (revision 127319) +++ tree-sra.c (working copy) @@ -2400,6 +2400,8 @@ tree_sra (void) scan_function (); decide_instantiations (); scalarize_function (); + if (!bitmap_empty_p (sra_candidates)) + todoflags |= TODO_rebuild_alias; } /* Free allocated memory. */ @@ -2422,7 +2424,7 @@ tree_sra_early (void) ret = tree_sra (); early_sra = false; - return ret; + return ret & ~TODO_rebuild_alias; } static bool Index: tree-flow.h =================================================================== --- tree-flow.h (revision 127319) +++ tree-flow.h (working copy) @@ -825,6 +825,7 @@ extern void record_vars (tree); extern bool block_may_fallthru (tree); /* In tree-ssa-alias.c */ +extern unsigned int compute_may_aliases (void); extern void dump_may_aliases_for (FILE *, tree); extern void debug_may_aliases_for (tree); extern void dump_alias_info (FILE *); Index: passes.c =================================================================== --- passes.c (revision 127319) +++ passes.c (working copy) @@ -551,7 +551,6 @@ init_optimization_passes (void) { struct tree_opt_pass **p = &pass_all_optimizations.sub; NEXT_PASS (pass_create_structure_vars); - NEXT_PASS (pass_may_alias); NEXT_PASS (pass_return_slot); NEXT_PASS (pass_rename_ssa_copies); @@ -566,26 +565,19 @@ init_optimization_passes (void) NEXT_PASS (pass_vrp); NEXT_PASS (pass_dce); NEXT_PASS (pass_dominator); - /* The only const/copy propagation opportunities left after DOM should be due to degenerate PHI nodes. So rather than run the full propagators, run a specialized pass which only examines PHIs to discover const/copy propagation opportunities. */ NEXT_PASS (pass_phi_only_cprop); - NEXT_PASS (pass_tree_ifcombine); NEXT_PASS (pass_phiopt); - NEXT_PASS (pass_may_alias); NEXT_PASS (pass_tail_recursion); NEXT_PASS (pass_ch); NEXT_PASS (pass_stdarg); NEXT_PASS (pass_lower_complex); NEXT_PASS (pass_sra); - /* FIXME: SRA may generate arbitrary gimple code, exposing new - aliased and call-clobbered variables. As mentioned below, - pass_may_alias should be a TODO item. */ - NEXT_PASS (pass_may_alias); NEXT_PASS (pass_rename_ssa_copies); NEXT_PASS (pass_dominator); @@ -599,7 +591,6 @@ init_optimization_passes (void) NEXT_PASS (pass_reassoc); NEXT_PASS (pass_dce); NEXT_PASS (pass_dse); - NEXT_PASS (pass_may_alias); NEXT_PASS (pass_forwprop); NEXT_PASS (pass_phiopt); NEXT_PASS (pass_object_sizes); @@ -610,10 +601,8 @@ init_optimization_passes (void) /* FIXME: May alias should a TODO but for 4.0.0, we add may_alias right after fold builtins which can create arbitrary GIMPLE. */ - NEXT_PASS (pass_may_alias); NEXT_PASS (pass_split_crit_edges); NEXT_PASS (pass_pre); - NEXT_PASS (pass_may_alias); NEXT_PASS (pass_sink_code); NEXT_PASS (pass_tree_loop); { @@ -637,9 +626,6 @@ init_optimization_passes (void) NEXT_PASS (pass_lower_vector_ssa); NEXT_PASS (pass_dce_loop); } - /* NEXT_PASS (pass_may_alias) cannot be done again because the - vectorizer creates alias relations that are not supported by - pass_may_alias. */ NEXT_PASS (pass_complete_unroll); NEXT_PASS (pass_loop_prefetch); NEXT_PASS (pass_iv_optimize); @@ -650,7 +636,7 @@ init_optimization_passes (void) NEXT_PASS (pass_reassoc); NEXT_PASS (pass_vrp); NEXT_PASS (pass_dominator); - + /* The only const/copy propagation opportunities left after DOM should be due to degenerate PHI nodes. So rather than run the full propagators, run a specialized pass which @@ -912,7 +898,13 @@ execute_function_todo (void *data) update_ssa (update_flags); cfun->last_verified &= ~TODO_verify_ssa; } - + + if (flags & TODO_rebuild_alias) + { + compute_may_aliases (); + cfun->curr_properties |= PROP_alias; + } + if (flags & TODO_remove_unused_locals) remove_unused_locals (); Index: testsuite/gcc.dg/tree-ssa/20040911-1.c =================================================================== --- testsuite/gcc.dg/tree-ssa/20040911-1.c (revision 127319) +++ testsuite/gcc.dg/tree-ssa/20040911-1.c (working copy) @@ -1,7 +1,7 @@ /* Verify that points-to information is handled properly for PTR + OFFSET pointer arithmetics. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-alias1-vops" } */ +/* { dg-options "-O2 -fdump-tree-salias-vops" } */ char buf[4], *q; int foo (int i) @@ -18,5 +18,5 @@ int foo (int i) return *p; } -/* { dg-final { scan-tree-dump-not "VUSE length; } -/* { dg-final { scan-tree-dump-times "VDEF