tree-pass.h (PROP_pta): Removed.

2007-08-14  Daniel Berlin  <dberlin@dberlin.org>

	* tree-pass.h (PROP_pta): Removed.
	(TODO_rebuild_alias): New.
	(pass_may_alias): Removed.
	* tree-ssa-ccp.c (execute_fold_all_builtins): Only rebuild
	aliasing if we changed something.
	* tree-ssa-alias.c (compute_may_aliases): Make non-static.  Update
	SSA internally.
	(pass_may_alias): Removed.
	(create_structure_vars): Return TODO_rebuild_alias.
	* tree-ssa-pre.c (do_pre): Return TODO_rebuild_alias.
	* tree-sra.c (tree_sra): Only rebuild aliasing if something
	changed.
	(tree_sra_early): We never affect aliasing right now.
	* tree-flow.h (compute_may_aliases): New prototype.
	* passes.c: Remove pass_may_alias from the passes.
	(execute_function_todo): Support TODO_rebuild_alias.

From-SVN: r127491
This commit is contained in:
Daniel Berlin 2007-08-14 20:52:47 +00:00
parent ea2666ba5e
commit 7b0e48fb44
18 changed files with 86 additions and 92 deletions

View File

@ -1,3 +1,22 @@
2007-08-14 Daniel Berlin <dberlin@dberlin.org>
* tree-pass.h (PROP_pta): Removed.
(TODO_rebuild_alias): New.
(pass_may_alias): Removed.
* tree-ssa-ccp.c (execute_fold_all_builtins): Only rebuild
aliasing if we changed something.
* tree-ssa-alias.c (compute_may_aliases): Make non-static. Update
SSA internally.
(pass_may_alias): Removed.
(create_structure_vars): Return TODO_rebuild_alias.
* tree-ssa-pre.c (do_pre): Return TODO_rebuild_alias.
* tree-sra.c (tree_sra): Only rebuild aliasing if something
changed.
(tree_sra_early): We never affect aliasing right now.
* tree-flow.h (compute_may_aliases): New prototype.
* passes.c: Remove pass_may_alias from the passes.
(execute_function_todo): Support TODO_rebuild_alias.
2007-08-14 Kai Tietz <kai.tietz@onevision.com> 2007-08-14 Kai Tietz <kai.tietz@onevision.com>
* i386.c: (legitimize_address): Move dllimported variable check * i386.c: (legitimize_address): Move dllimported variable check
@ -385,6 +404,7 @@
* emit-rtl.c (try_split): Relink the insns with REG_LIBCALL note * emit-rtl.c (try_split): Relink the insns with REG_LIBCALL note
and with REG_RETVAL note after split. and with REG_RETVAL note after split.
>>>>>>> .r127481
2007-08-11 David Daney <ddaney@avtrex.com> 2007-08-11 David Daney <ddaney@avtrex.com>
* config/mips/mips.c (mips_sched_reorder): Mark cycle parameter * config/mips/mips.c (mips_sched_reorder): Mark cycle parameter

View File

@ -551,7 +551,6 @@ init_optimization_passes (void)
{ {
struct tree_opt_pass **p = &pass_all_optimizations.sub; struct tree_opt_pass **p = &pass_all_optimizations.sub;
NEXT_PASS (pass_create_structure_vars); NEXT_PASS (pass_create_structure_vars);
NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_return_slot); NEXT_PASS (pass_return_slot);
NEXT_PASS (pass_rename_ssa_copies); NEXT_PASS (pass_rename_ssa_copies);
@ -566,26 +565,19 @@ init_optimization_passes (void)
NEXT_PASS (pass_vrp); NEXT_PASS (pass_vrp);
NEXT_PASS (pass_dce); NEXT_PASS (pass_dce);
NEXT_PASS (pass_dominator); NEXT_PASS (pass_dominator);
/* The only const/copy propagation opportunities left after /* The only const/copy propagation opportunities left after
DOM should be due to degenerate PHI nodes. So rather than DOM should be due to degenerate PHI nodes. So rather than
run the full propagators, run a specialized pass which run the full propagators, run a specialized pass which
only examines PHIs to discover const/copy propagation only examines PHIs to discover const/copy propagation
opportunities. */ opportunities. */
NEXT_PASS (pass_phi_only_cprop); NEXT_PASS (pass_phi_only_cprop);
NEXT_PASS (pass_tree_ifcombine); NEXT_PASS (pass_tree_ifcombine);
NEXT_PASS (pass_phiopt); NEXT_PASS (pass_phiopt);
NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_tail_recursion); NEXT_PASS (pass_tail_recursion);
NEXT_PASS (pass_ch); NEXT_PASS (pass_ch);
NEXT_PASS (pass_stdarg); NEXT_PASS (pass_stdarg);
NEXT_PASS (pass_lower_complex); NEXT_PASS (pass_lower_complex);
NEXT_PASS (pass_sra); 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_rename_ssa_copies);
NEXT_PASS (pass_dominator); NEXT_PASS (pass_dominator);
@ -599,7 +591,6 @@ init_optimization_passes (void)
NEXT_PASS (pass_reassoc); NEXT_PASS (pass_reassoc);
NEXT_PASS (pass_dce); NEXT_PASS (pass_dce);
NEXT_PASS (pass_dse); NEXT_PASS (pass_dse);
NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_forwprop); NEXT_PASS (pass_forwprop);
NEXT_PASS (pass_phiopt); NEXT_PASS (pass_phiopt);
NEXT_PASS (pass_object_sizes); NEXT_PASS (pass_object_sizes);
@ -607,13 +598,8 @@ init_optimization_passes (void)
NEXT_PASS (pass_store_copy_prop); NEXT_PASS (pass_store_copy_prop);
NEXT_PASS (pass_fold_builtins); NEXT_PASS (pass_fold_builtins);
NEXT_PASS (pass_cse_sincos); NEXT_PASS (pass_cse_sincos);
/* 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_split_crit_edges);
NEXT_PASS (pass_pre); NEXT_PASS (pass_pre);
NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_sink_code); NEXT_PASS (pass_sink_code);
NEXT_PASS (pass_tree_loop); NEXT_PASS (pass_tree_loop);
{ {
@ -637,9 +623,6 @@ init_optimization_passes (void)
NEXT_PASS (pass_lower_vector_ssa); NEXT_PASS (pass_lower_vector_ssa);
NEXT_PASS (pass_dce_loop); 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_complete_unroll);
NEXT_PASS (pass_loop_prefetch); NEXT_PASS (pass_loop_prefetch);
NEXT_PASS (pass_iv_optimize); NEXT_PASS (pass_iv_optimize);
@ -650,7 +633,7 @@ init_optimization_passes (void)
NEXT_PASS (pass_reassoc); NEXT_PASS (pass_reassoc);
NEXT_PASS (pass_vrp); NEXT_PASS (pass_vrp);
NEXT_PASS (pass_dominator); NEXT_PASS (pass_dominator);
/* The only const/copy propagation opportunities left after /* The only const/copy propagation opportunities left after
DOM should be due to degenerate PHI nodes. So rather than DOM should be due to degenerate PHI nodes. So rather than
run the full propagators, run a specialized pass which run the full propagators, run a specialized pass which
@ -912,7 +895,13 @@ execute_function_todo (void *data)
update_ssa (update_flags); update_ssa (update_flags);
cfun->last_verified &= ~TODO_verify_ssa; 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) if (flags & TODO_remove_unused_locals)
remove_unused_locals (); remove_unused_locals ();

View File

@ -1,7 +1,7 @@
/* With tree-ssa, gcc.dg/20000724-1.c failed because we missed /* With tree-ssa, gcc.dg/20000724-1.c failed because we missed
a VOP of x in the asm statement. */ a VOP of x in the asm statement. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-alias1-vops" } */ /* { dg-options "-O1 -fdump-tree-salias-vops" } */
struct s { int a; }; struct s { int a; };
@ -14,5 +14,5 @@ main(void)
} }
/* The VDEF comes from the initial assignment and the asm. */ /* The VDEF comes from the initial assignment and the asm. */
/* { dg-final { scan-tree-dump-times "DEF" 2 "alias1" } } */ /* { dg-final { scan-tree-dump-times "DEF" 2 "salias" } } */
/* { dg-final { cleanup-tree-dump "alias1" } } */ /* { dg-final { cleanup-tree-dump "salias" } } */

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-alias1-vops" } */ /* { dg-options "-O1 -fdump-tree-salias-vops" } */
extern void abort (void); extern void abort (void);
int a; int a;
@ -17,5 +17,5 @@ void bar (void)
malloc functions may clobber global memory. Only the function result malloc functions may clobber global memory. Only the function result
does not alias any other pointer. does not alias any other pointer.
Hence, we must have a VDEF for a before and after the call to foo(). */ Hence, we must have a VDEF for a before and after the call to foo(). */
/* { dg-final { scan-tree-dump-times "VDEF" 2 "alias1"} } */ /* { dg-final { scan-tree-dump-times "VDEF" 2 "salias"} } */
/* { dg-final { cleanup-tree-dump "alias1" } } */ /* { dg-final { cleanup-tree-dump "salias" } } */

View File

@ -1,7 +1,7 @@
/* Verify that points-to information is handled properly for PTR + OFFSET /* Verify that points-to information is handled properly for PTR + OFFSET
pointer arithmetics. */ pointer arithmetics. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-alias1-vops" } */ /* { dg-options "-O2 -fdump-tree-salias-vops" } */
char buf[4], *q; char buf[4], *q;
int foo (int i) int foo (int i)
@ -18,5 +18,5 @@ int foo (int i)
return *p; return *p;
} }
/* { dg-final { scan-tree-dump-not "VUSE <c" "alias1" } } */ /* { dg-final { scan-tree-dump-not "VUSE <c" "salias" } } */
/* { dg-final { cleanup-tree-dump "alias1" } } */ /* { dg-final { cleanup-tree-dump "salias" } } */

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-alias1-vops" } */ /* { dg-options "-O2 -fdump-tree-salias-vops" } */
struct { struct {
int i; int i;
@ -13,6 +13,6 @@ int foo(int i)
return a.x[i]; return a.x[i];
} }
/* { dg-final { scan-tree-dump "VDEF" "alias1" } } */ /* { dg-final { scan-tree-dump "VDEF" "salias" } } */
/* { dg-final { cleanup-tree-dump "alias1" } } */ /* { dg-final { cleanup-tree-dump "salias" } } */

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-optimized -fdump-tree-alias1-vops" } */ /* { dg-options "-O1 -fdump-tree-optimized -fdump-tree-salias-vops" } */
/* Test to make sure that inline-asm causes a V_MAY_DEF and that we call test_function twice. */ /* Test to make sure that inline-asm causes a V_MAY_DEF and that we call test_function twice. */
char test_function(void ) __attribute__((__pure__)); char test_function(void ) __attribute__((__pure__));
@ -16,5 +16,5 @@ char f(char *a)
/* { dg-final { cleanup-tree-dump "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */
/* There should a VDEF for the inline-asm. */ /* There should a VDEF for the inline-asm. */
/* { dg-final { scan-tree-dump-times "VDEF" 1 "alias1"} } */ /* { dg-final { scan-tree-dump-times "VDEF" 1 "salias"} } */
/* { dg-final { cleanup-tree-dump "alias1" } } */ /* { dg-final { cleanup-tree-dump "salias" } } */

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-alias1-vops" } */ /* { dg-options "-O1 -fdump-tree-salias-vops" } */
/* Test to make sure that inline-asm causes a V_MAY_DEF. */ /* Test to make sure that inline-asm causes a V_MAY_DEF. */
@ -14,5 +14,5 @@ void f(char *a)
} }
/* There should a VDEF for the inline-asm and one for the link_error. */ /* There should a VDEF for the inline-asm and one for the link_error. */
/* { dg-final { scan-tree-dump-times "VDEF" 2 "alias1"} } */ /* { dg-final { scan-tree-dump-times "VDEF" 2 "salias"} } */
/* { dg-final { cleanup-tree-dump "alias1" } } */ /* { dg-final { cleanup-tree-dump "salias" } } */

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-alias-vops" } */ /* { dg-options "-O2 -fdump-tree-salias-vops" } */
struct a struct a
{ {
int length; int length;
@ -13,14 +13,5 @@ int f(void)
struct a *a = malloc(sizeof(struct a)); struct a *a = malloc(sizeof(struct a));
return a->length; return a->length;
} }
/* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "alias1"} } */ /* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "salias"} } */
/* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "alias2"} } */ /* { dg-final { cleanup-tree-dump "salias" } } */
/* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "alias3"} } */
/* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "alias4"} } */
/* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "alias5"} } */
/* { dg-final { cleanup-tree-dump "alias1" } } */
/* { dg-final { cleanup-tree-dump "alias2" } } */
/* { dg-final { cleanup-tree-dump "alias3" } } */
/* { dg-final { cleanup-tree-dump "alias4" } } */
/* { dg-final { cleanup-tree-dump "alias5" } } */
/* { dg-final { cleanup-tree-dump "alias6" } } */

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-alias1-vops" } */ /* { dg-options "-O2 -fdump-tree-salias-vops" } */
typedef struct { typedef struct {
int i; int i;
@ -16,5 +16,5 @@ int foo(void)
return a.i; return a.i;
} }
/* { dg-final { scan-tree-dump-times "VDEF" 2 "alias1" } } */ /* { dg-final { scan-tree-dump-times "VDEF" 2 "salias" } } */
/* { dg-final { cleanup-tree-dump "alias1" } } */ /* { dg-final { cleanup-tree-dump "salias" } } */

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-alias1" } */ /* { dg-options "-O2 -fdump-tree-salias" } */
extern double cos (double); extern double cos (double);
extern double sin (double); extern double sin (double);
double f(double a) double f(double a)
@ -22,5 +22,5 @@ double f(double a)
} }
/* The points-to set of the final function pointer should be "sin cos" */ /* The points-to set of the final function pointer should be "sin cos" */
/* { dg-final { scan-tree-dump-times "{ sin cos }" 1 "alias1"} } */ /* { dg-final { scan-tree-dump-times "{ sin cos }" 1 "salias"} } */
/* { dg-final { cleanup-tree-dump "alias1" } } */ /* { dg-final { cleanup-tree-dump "salias" } } */

View File

@ -15,5 +15,5 @@ int foo(void)
return a.b.c.j; return a.b.c.j;
} }
/* { dg-final { scan-tree-dump-times "SFT" 2 "salias" } } */ /* { dg-final { scan-tree-dump-times "structure field tag SFT" 2 "salias" } } */
/* { dg-final { cleanup-tree-dump "salias" } } */ /* { dg-final { cleanup-tree-dump "salias" } } */

View File

@ -831,6 +831,7 @@ extern void record_vars (tree);
extern bool block_may_fallthru (const_tree); extern bool block_may_fallthru (const_tree);
/* In tree-ssa-alias.c */ /* In tree-ssa-alias.c */
extern unsigned int compute_may_aliases (void);
extern void dump_may_aliases_for (FILE *, tree); extern void dump_may_aliases_for (FILE *, tree);
extern void debug_may_aliases_for (tree); extern void debug_may_aliases_for (tree);
extern void dump_alias_info (FILE *); extern void dump_alias_info (FILE *);

View File

@ -149,12 +149,11 @@ struct dump_file_info
#define PROP_gimple_leh (1 << 2) /* lowered eh */ #define PROP_gimple_leh (1 << 2) /* lowered eh */
#define PROP_cfg (1 << 3) #define PROP_cfg (1 << 3)
#define PROP_referenced_vars (1 << 4) #define PROP_referenced_vars (1 << 4)
#define PROP_pta (1 << 5) #define PROP_ssa (1 << 5)
#define PROP_ssa (1 << 6) #define PROP_no_crit_edges (1 << 6)
#define PROP_no_crit_edges (1 << 7) #define PROP_rtl (1 << 7)
#define PROP_rtl (1 << 8) #define PROP_alias (1 << 8)
#define PROP_alias (1 << 9) #define PROP_gimple_lomp (1 << 9) /* lowered OpenMP directives */
#define PROP_gimple_lomp (1 << 10) /* lowered OpenMP directives */
#define PROP_trees \ #define PROP_trees \
(PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp) (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. */ /* Internally used for the first instance of a pass. */
#define TODO_mark_first_instance (1 << 18) #define TODO_mark_first_instance (1 << 18)
/* Rebuild aliasing info. */
#define TODO_rebuild_alias (1 << 19)
#define TODO_update_ssa_any \ #define TODO_update_ssa_any \
(TODO_update_ssa \ (TODO_update_ssa \
| TODO_update_ssa_no_phi \ | 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_dce_loop;
extern struct tree_opt_pass pass_cd_dce; extern struct tree_opt_pass pass_cd_dce;
extern struct tree_opt_pass pass_merge_phi; 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_split_crit_edges;
extern struct tree_opt_pass pass_pre; extern struct tree_opt_pass pass_pre;
extern struct tree_opt_pass pass_profile; extern struct tree_opt_pass pass_profile;

View File

@ -2400,6 +2400,8 @@ tree_sra (void)
scan_function (); scan_function ();
decide_instantiations (); decide_instantiations ();
scalarize_function (); scalarize_function ();
if (!bitmap_empty_p (sra_candidates))
todoflags |= TODO_rebuild_alias;
} }
/* Free allocated memory. */ /* Free allocated memory. */
@ -2422,7 +2424,7 @@ tree_sra_early (void)
ret = tree_sra (); ret = tree_sra ();
early_sra = false; early_sra = false;
return ret; return ret & ~TODO_rebuild_alias;
} }
static bool static bool

View File

@ -1634,10 +1634,12 @@ done:
grouped to avoid severe compile-time slow downs and memory grouped to avoid severe compile-time slow downs and memory
consumption. See compute_memory_partitions. */ consumption. See compute_memory_partitions. */
static unsigned int unsigned int
compute_may_aliases (void) compute_may_aliases (void)
{ {
struct alias_info *ai; struct alias_info *ai;
timevar_push (TV_TREE_MAY_ALIAS);
memset (&alias_stats, 0, sizeof (alias_stats)); memset (&alias_stats, 0, sizeof (alias_stats));
@ -1731,33 +1733,15 @@ compute_may_aliases (void)
/* Deallocate memory used by aliasing data structures. */ /* Deallocate memory used by aliasing data structures. */
delete_alias_info (ai); delete_alias_info (ai);
if (need_ssa_update_p ())
update_ssa (TODO_update_ssa);
timevar_pop (TV_TREE_MAY_ALIAS);
return 0; 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 /* Data structure used to count the number of dereferences to PTR
inside an expression. */ inside an expression. */
struct count_ptr_d struct count_ptr_d
@ -4028,7 +4012,7 @@ create_structure_vars (void)
} }
} }
return 0; return TODO_rebuild_alias;
} }
static bool static bool

View File

@ -2640,6 +2640,8 @@ execute_fold_all_builtins (void)
{ {
bool cfg_changed = false; bool cfg_changed = false;
basic_block bb; basic_block bb;
unsigned int todoflags = 0;
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
block_stmt_iterator i; block_stmt_iterator i;
@ -2697,6 +2699,7 @@ execute_fold_all_builtins (void)
{ {
bool ok = set_rhs (stmtp, result); bool ok = set_rhs (stmtp, result);
gcc_assert (ok); gcc_assert (ok);
todoflags |= TODO_rebuild_alias;
} }
} }
@ -2728,9 +2731,12 @@ execute_fold_all_builtins (void)
bsi_next (&i); bsi_next (&i);
} }
} }
/* Delete unreachable blocks. */ /* Delete unreachable blocks. */
return cfg_changed ? TODO_cleanup_cfg : 0; if (cfg_changed)
todoflags |= TODO_cleanup_cfg;
return todoflags;
} }

View File

@ -3981,7 +3981,7 @@ static unsigned int
do_pre (void) do_pre (void)
{ {
execute_pre (false); execute_pre (false);
return 0; return TODO_rebuild_alias;
} }
static bool static bool