This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][alias-improvements] Adjust update-address-taken to mainline behavior
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 27 Nov 2008 13:18:57 +0100 (CET)
- Subject: [PATCH][alias-improvements] Adjust update-address-taken to mainline behavior
This adjusts when we run update-address-taken to mainline behavior.
Previous patches split out updating address-taken state and promotion
to registers from alias computation to the already existing
update-address-taken pass. This patch automatically invokes this pass
whenever we re-compute aliasing (in the end we may want to optimize
placements of address/alias updating - alias recomputation is no
longer necessary for correctness purposes on the branch).
This makes us match mainline behavior and fixes tree-ssa/pr19431.c
which relies on register promotion during the second alias recomputation.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to the
branch.
Richard.
2008-11-27 Richard Guenther <rguenther@suse.de>
* passes.c (init_optimization_passes): Remove pass_update_address_taken
before initial PTA pass again.
(execute_function_todo): For TODO_rebuild_alias run
update_address_taken before compute_may_aliases.
* tree-flow.h (execute_update_addresses_taken): Declare.
* tree-ssa.c (execute_update_addresses_taken): Export. Update SSA
manually.
(pass_update_address_taken): Remove TODO_update_ssa, add
TODO_dump_func.
Index: alias-improvements/gcc/passes.c
===================================================================
*** alias-improvements.orig/gcc/passes.c 2008-11-26 18:22:15.000000000 +0100
--- alias-improvements/gcc/passes.c 2008-11-26 18:22:34.000000000 +0100
*************** init_optimization_passes (void)
*** 600,606 ****
calls, it is better to do the transformation
here where memory SSA is not built yet. */
NEXT_PASS (pass_call_cdce);
- NEXT_PASS (pass_update_address_taken);
/* pass_build_alias is a dummy pass that ensures that we
execute TODO_rebuild_alias at this point. Re-building
alias information also rewrites no longer addressed
--- 600,605 ----
*************** execute_function_todo (void *data)
*** 945,950 ****
--- 944,950 ----
if (flags & TODO_rebuild_alias)
{
+ execute_update_addresses_taken ();
compute_may_aliases ();
cfun->curr_properties |= PROP_alias;
}
Index: alias-improvements/gcc/tree-flow.h
===================================================================
*** alias-improvements.orig/gcc/tree-flow.h 2008-11-26 13:48:08.000000000 +0100
--- alias-improvements/gcc/tree-flow.h 2008-11-26 18:19:07.000000000 +0100
*************** extern void verify_ssa (bool);
*** 753,758 ****
--- 753,759 ----
extern void delete_tree_ssa (void);
extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
extern bool ssa_undefined_value_p (tree);
+ unsigned int execute_update_addresses_taken (void);
/* In tree-into-ssa.c */
Index: alias-improvements/gcc/tree-ssa.c
===================================================================
*** alias-improvements.orig/gcc/tree-ssa.c 2008-11-26 18:17:50.000000000 +0100
--- alias-improvements/gcc/tree-ssa.c 2008-11-26 18:22:38.000000000 +0100
*************** struct gimple_opt_pass pass_late_warn_un
*** 1469,1475 ****
/* Compute TREE_ADDRESSABLE and DECL_GIMPLE_REG_P for local variables. */
! static unsigned int
execute_update_addresses_taken (void)
{
tree var;
--- 1469,1475 ----
/* Compute TREE_ADDRESSABLE and DECL_GIMPLE_REG_P for local variables. */
! unsigned int
execute_update_addresses_taken (void)
{
tree var;
*************** execute_update_addresses_taken (void)
*** 1572,1585 ****
/* Operand caches needs to be recomputed for operands referencing the updated
variables. */
if (update_vops)
! FOR_EACH_BB (bb)
! for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
! {
! gimple stmt = gsi_stmt (gsi);
! if (gimple_references_memory_p (stmt))
! update_stmt (stmt);
! }
BITMAP_FREE (not_reg_needs);
--- 1572,1590 ----
/* Operand caches needs to be recomputed for operands referencing the updated
variables. */
if (update_vops)
! {
! FOR_EACH_BB (bb)
! for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
! {
! gimple stmt = gsi_stmt (gsi);
! if (gimple_references_memory_p (stmt))
! update_stmt (stmt);
! }
!
! /* Update SSA form here, we are called as non-pass as well. */
! update_ssa (TODO_update_ssa);
! }
BITMAP_FREE (not_reg_needs);
*************** struct gimple_opt_pass pass_update_addre
*** 1601,1606 ****
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
! TODO_update_ssa /* todo_flags_finish */
}
};
--- 1606,1611 ----
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
! TODO_dump_func /* todo_flags_finish */
}
};