Commit 84d65814 by Diego Novillo

[multiple changes]

2005-04-22  Diego Novillo  <dnovillo@redhat.com>

	* Makefile.in (tree-into-ssa.o): Add dependency on PARAMS_H.
	* lambda-code.c (perfect_nestify): Mark virtual operands in
	the moved statement for renaming.
	* params.def (PARAM_MIN_VIRTUAL_MAPPINGS): Define.
	(PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
	* params.h (MIN_VIRTUAL_MAPPINGS): Define.
	(VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
	* tree-flow.h (struct var_ann_d): Update comments.
	(rewrite_to_new_ssa_names_bb, rewrite_to_new_ssa_names,
	allocate_ssa_names, find_phi_node_for, dump_tree_ssa,
	debug_tree_ssa, debug_def_blocks, dump_tree_ssa_stats,
	debug_tree_ssa_stats, rewrite_ssa_into_ssa,
	dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by,
	debug_names_replaced_by): Remove declarations.
	(delete_update_ssa, get_current_def, set_current_def): Declare.
	(rewrite_into_loop_closed_ssa): Add new argument.  Update
	all callers.
	* tree-into-ssa.c: Include params.h.
	(old_virtual_ssa_names): Remove.  Update all users.
	(need_to_replace_names_p): Remove.  Update all users.
	(struct update_ssa_stats_d): Declare.
	(update_ssa_stats): New local.
	(dump_tree_ssa, debug_tree_ssa, debug_def_blocks,
	dump_tree_ssa_stats, debug_tree_ssa_stats,
	dump_update_ssa, debug_update_ssa,
	dump_names_replaced_by, debug_names_replaced_by): Declare.
	(get_current_def, set current_def): Make extern.
	(is_old_name, is_new_name): Protect against references
	past the end of the sets.
	(add_new_name_mapping): Assert that OLD and NEW are
	different SSA names for the same symbol.
	When adding a virtual mapping, update stats for virtual
	mapping heuristic.
	(insert_phi_nodes_for): If UPDATE_P is true, create the
	LHS of the new PHI by duplicating SSA name VAR.
	(insert_phi_nodes_1): Remove.  Update all users.
	(insert_phi_nodes): Remove second argument.  Update all
	users.
	(maybe_replace_use, maybe_replace_def): New.
	(rewrite_update_stmt): Call them.
	(mark_def_interesting): Remove calls to is_gimple_reg.
	(prepare_phi_args_for_update): Remove.  Update all users.
	(prepare_block_for_update): Only process virtual operands
	and GIMPLE registers in normal form.
	(prepare_use_sites_for): New.
	(prepare_names_to_update): Rename from prepare_def_sites.
	Call prepare_use_sites_for.
	(dump_update_ssa): Rename from dump_repl_tbl.
	Update all users.
	Show statistics for virtual mapping heuristic.
	(debug_update_ssa): Rename from debug_debug_repl_tbl.
	(init_update_ssa): Initialize UPDATE_SSA_STATS.
	(delete_update_ssa): Make extern.
	(mark_set_for_renaming): If the set is empty, do nothing.
	(release_ssa_name_after_update_ssa): Update comment.
	(insert_updated_phi_nodes_for): Do not remove existing
	PHI nodes for symbols.
	(switch_virtuals_to_full_rewrite_p): New.
	(switch_virtuals_to_full_rewrite): New.
	(update_ssa): Call them.
	Clear REWRITE_THIS_STMT and REGISTER_DEFS_IN_THIS_STMT
	for every statement before updating.
	If all the names in NEW_SSA_NAMES have been marked for
	removal, do nothing.
	Only start at the top of the CFG if there are symbols in
	SYMS_TO_RENAME.
	(ssa_rewrite_finalize_block): Remove.
	(ssa_register_new_def): Remove.
	(ssa_rewrite_stmt): Remove.
	(ssa_rewrite_phi_arguments): Remove.
	(ssa_rewrite_initialize_block): Remove.
	(ssa_mark_def_sites): Remove.
	(ssa_mark_def_sites_initialize_block): Remove.
	(ssa_mark_phi_uses): Remove.
	(rewrite_ssa_into_ssa): Remove.
	* tree-phinodes.c (find_phi_node_for): Remove.
	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely):
	Call update_ssa.
	* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops):
	Remove calls to verify_dominators and
	verify_loop_structure.
	(tree_unswitch_single_loop): Call update_ssa.
	* tree-ssa.c (verify_ssa): Assert that need_ssa_update_p
	returns false.
	Call verify_stmts.
	(delete_tree_ssa): Assert that need_ssa_update_p returns
	false.
	* tree-vect-transform.c (vect_transform_loop): Call update_ssa.
	* tree-vectorizer.c (allocate_new_names, rename_def_op,
	free_new_names): Remove.  Update all users.
	(rename_use_op): Call get_current_def.
	(rename_variables_in_bb): Do not handle any real or
	virtual definition.
	(slpeel_update_phis_for_duplicate_loop): Call
	get_current_def and set_current_def instead of using
	SSA_NAME_AUX.
	(slpeel_update_phi_nodes_for_guard2): Reformat comments.
	(slpeel_can_duplicate_loop_p): Call need_ssa_update_p,
	ssa_names_to_replace and delete_update_ssa.
	* doc/invoke.texi: Document --param min-virtual-mappings
	and --param virtual-mappings-ratio.

2005-04-22  Zdenek Dvorak  <dvorakz@suse.cz>
	    Diego Novillo  <dnovillo@redhat.com>

	* tree-cfg.c (tree_duplicate_bb): Call create_new_def_for
	for newly created PHI nodes.
	Call create_new_def_for for every new V_MAY_DEF and
	V_MUST_DEF on the copied statement.
	(struct ssa_name_map_entry): Remove.
	(ssa_name_map_entry_hash): Remove.
	(ssa_name_map_entry_eq): Remove.
	(allocate_ssa_names): Remove.
	(rewrite_to_new_ssa_names_def): Remove.
	(rewrite_to_new_ssa_names_use): Remove.
	(rewrite_to_new_ssa_names_bb): Remove.
	(rewrite_to_new_ssa_names): Remove.
	(tree_duplicate_sese_region): Remove variables ver,
	definitions, phi, ssa_name_map and bi.
	Call need_ssa_update_p instead of any_marked_for_rewrite_p.
	Call update_ssa.
	* tree-ssa-dom.c (tree_ssa_dominator_optimize): Call
	update_ssa instead of rewrite_ssa_into_ssa.
	* tree-ssa-loop-manip.c (add_exit_phis_edge): Call
	create_new_def_for.
	(find_uses_to_rename_use): Add argument 'need_phis'.
	(find_uses_to_rename_stmt): Do not scan virtual operands.
	(find_uses_to_rename): Only scan PHI nodes for
	non-virtual names.
	(rewrite_into_loop_closed_ssa): Call update_ssa.
	(check_loop_closed_ssa_use): Ignore virtual operands.
	(check_loop_closed_ssa_stmt): Likewise.
	(verify_loop_closed_ssa): Do nothing if CURRENT_LOOPS is
	NULL.
	(rename_variables, set_phi_def_stmts): Remove.
	(tree_duplicate_loop_to_header_edge): Reformat comment.
	Remove variables BB, I and DEFINITIONS.
	Call need_ssa_update_p.
	Call update_ssa.
	(lv_adjust_loop_header_phi): Reformat comment.
	* tree-ssanames.c (ssa_names_to_rewrite): Remove.
	(marked_for_rewrite_p, any_marked_for_rewrite_p,
	mark_for_rewrite, unmark_all_for_rewrite,
	marked_ssa_names): Remove.  Update all users.
	(release_ssa_name): If VAR has been registered for SSA
	updating, do nothing.
	* tree-vrp.c (new_ssa_names, old_ssa_names): Remove.
	(build_assert_expr_for): Call register_new_name_mapping.
	(insert_range_assertions): Update call to update_ssa.
	* tree.h (mark_for_rewrite, unmark_all_for_rewrite,
	marked_for_rewrite_p, any_marked_for_rewrite_p,
	marked_ssa_names): Remove.

From-SVN: r98599
parent be240c88
2005-04-22 Diego Novillo <dnovillo@redhat.com>
* Makefile.in (tree-into-ssa.o): Add dependency on PARAMS_H.
* lambda-code.c (perfect_nestify): Mark virtual operands in
the moved statement for renaming.
* params.def (PARAM_MIN_VIRTUAL_MAPPINGS): Define.
(PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
* params.h (MIN_VIRTUAL_MAPPINGS): Define.
(VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
* tree-flow.h (struct var_ann_d): Update comments.
(rewrite_to_new_ssa_names_bb, rewrite_to_new_ssa_names,
allocate_ssa_names, find_phi_node_for, dump_tree_ssa,
debug_tree_ssa, debug_def_blocks, dump_tree_ssa_stats,
debug_tree_ssa_stats, rewrite_ssa_into_ssa,
dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by,
debug_names_replaced_by): Remove declarations.
(delete_update_ssa, get_current_def, set_current_def): Declare.
(rewrite_into_loop_closed_ssa): Add new argument. Update
all callers.
* tree-into-ssa.c: Include params.h.
(old_virtual_ssa_names): Remove. Update all users.
(need_to_replace_names_p): Remove. Update all users.
(struct update_ssa_stats_d): Declare.
(update_ssa_stats): New local.
(dump_tree_ssa, debug_tree_ssa, debug_def_blocks,
dump_tree_ssa_stats, debug_tree_ssa_stats,
dump_update_ssa, debug_update_ssa,
dump_names_replaced_by, debug_names_replaced_by): Declare.
(get_current_def, set current_def): Make extern.
(is_old_name, is_new_name): Protect against references
past the end of the sets.
(add_new_name_mapping): Assert that OLD and NEW are
different SSA names for the same symbol.
When adding a virtual mapping, update stats for virtual
mapping heuristic.
(insert_phi_nodes_for): If UPDATE_P is true, create the
LHS of the new PHI by duplicating SSA name VAR.
(insert_phi_nodes_1): Remove. Update all users.
(insert_phi_nodes): Remove second argument. Update all
users.
(maybe_replace_use, maybe_replace_def): New.
(rewrite_update_stmt): Call them.
(mark_def_interesting): Remove calls to is_gimple_reg.
(prepare_phi_args_for_update): Remove. Update all users.
(prepare_block_for_update): Only process virtual operands
and GIMPLE registers in normal form.
(prepare_use_sites_for): New.
(prepare_names_to_update): Rename from prepare_def_sites.
Call prepare_use_sites_for.
(dump_update_ssa): Rename from dump_repl_tbl.
Update all users.
Show statistics for virtual mapping heuristic.
(debug_update_ssa): Rename from debug_debug_repl_tbl.
(init_update_ssa): Initialize UPDATE_SSA_STATS.
(delete_update_ssa): Make extern.
(mark_set_for_renaming): If the set is empty, do nothing.
(release_ssa_name_after_update_ssa): Update comment.
(insert_updated_phi_nodes_for): Do not remove existing
PHI nodes for symbols.
(switch_virtuals_to_full_rewrite_p): New.
(switch_virtuals_to_full_rewrite): New.
(update_ssa): Call them.
Clear REWRITE_THIS_STMT and REGISTER_DEFS_IN_THIS_STMT
for every statement before updating.
If all the names in NEW_SSA_NAMES have been marked for
removal, do nothing.
Only start at the top of the CFG if there are symbols in
SYMS_TO_RENAME.
(ssa_rewrite_finalize_block): Remove.
(ssa_register_new_def): Remove.
(ssa_rewrite_stmt): Remove.
(ssa_rewrite_phi_arguments): Remove.
(ssa_rewrite_initialize_block): Remove.
(ssa_mark_def_sites): Remove.
(ssa_mark_def_sites_initialize_block): Remove.
(ssa_mark_phi_uses): Remove.
(rewrite_ssa_into_ssa): Remove.
* tree-phinodes.c (find_phi_node_for): Remove.
* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely):
Call update_ssa.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops):
Remove calls to verify_dominators and
verify_loop_structure.
(tree_unswitch_single_loop): Call update_ssa.
* tree-ssa.c (verify_ssa): Assert that need_ssa_update_p
returns false.
Call verify_stmts.
(delete_tree_ssa): Assert that need_ssa_update_p returns
false.
* tree-vect-transform.c (vect_transform_loop): Call update_ssa.
* tree-vectorizer.c (allocate_new_names, rename_def_op,
free_new_names): Remove. Update all users.
(rename_use_op): Call get_current_def.
(rename_variables_in_bb): Do not handle any real or
virtual definition.
(slpeel_update_phis_for_duplicate_loop): Call
get_current_def and set_current_def instead of using
SSA_NAME_AUX.
(slpeel_update_phi_nodes_for_guard2): Reformat comments.
(slpeel_can_duplicate_loop_p): Call need_ssa_update_p,
ssa_names_to_replace and delete_update_ssa.
* doc/invoke.texi: Document --param min-virtual-mappings
and --param virtual-mappings-ratio.
2005-04-22 Zdenek Dvorak <dvorakz@suse.cz>
Diego Novillo <dnovillo@redhat.com>
* tree-cfg.c (tree_duplicate_bb): Call create_new_def_for
for newly created PHI nodes.
Call create_new_def_for for every new V_MAY_DEF and
V_MUST_DEF on the copied statement.
(struct ssa_name_map_entry): Remove.
(ssa_name_map_entry_hash): Remove.
(ssa_name_map_entry_eq): Remove.
(allocate_ssa_names): Remove.
(rewrite_to_new_ssa_names_def): Remove.
(rewrite_to_new_ssa_names_use): Remove.
(rewrite_to_new_ssa_names_bb): Remove.
(rewrite_to_new_ssa_names): Remove.
(tree_duplicate_sese_region): Remove variables ver,
definitions, phi, ssa_name_map and bi.
Call need_ssa_update_p instead of any_marked_for_rewrite_p.
Call update_ssa.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Call
update_ssa instead of rewrite_ssa_into_ssa.
* tree-ssa-loop-manip.c (add_exit_phis_edge): Call
create_new_def_for.
(find_uses_to_rename_use): Add argument 'need_phis'.
(find_uses_to_rename_stmt): Do not scan virtual operands.
(find_uses_to_rename): Only scan PHI nodes for
non-virtual names.
(rewrite_into_loop_closed_ssa): Call update_ssa.
(check_loop_closed_ssa_use): Ignore virtual operands.
(check_loop_closed_ssa_stmt): Likewise.
(verify_loop_closed_ssa): Do nothing if CURRENT_LOOPS is
NULL.
(rename_variables, set_phi_def_stmts): Remove.
(tree_duplicate_loop_to_header_edge): Reformat comment.
Remove variables BB, I and DEFINITIONS.
Call need_ssa_update_p.
Call update_ssa.
(lv_adjust_loop_header_phi): Reformat comment.
* tree-ssanames.c (ssa_names_to_rewrite): Remove.
(marked_for_rewrite_p, any_marked_for_rewrite_p,
mark_for_rewrite, unmark_all_for_rewrite,
marked_ssa_names): Remove. Update all users.
(release_ssa_name): If VAR has been registered for SSA
updating, do nothing.
* tree-vrp.c (new_ssa_names, old_ssa_names): Remove.
(build_assert_expr_for): Call register_new_name_mapping.
(insert_range_assertions): Update call to update_ssa.
* tree.h (mark_for_rewrite, unmark_all_for_rewrite,
marked_for_rewrite_p, any_marked_for_rewrite_p,
marked_ssa_names): Remove.
2005-04-22 Jeff Law <law@redhat.com>
* tree-ssa-dom.c (block_defs_stack): Remove, no longer needed.
......
......@@ -1635,7 +1635,7 @@ tree-into-ssa.o : tree-into-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h diagnostic.h \
errors.h toplev.h function.h $(TIMEVAR_H) \
$(TM_H) coretypes.h $(TREE_DUMP_H) langhooks.h domwalk.h tree-pass.h \
$(GGC_H)
$(GGC_H) $(PARAMS_H)
tree-outof-ssa.o : tree-outof-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h diagnostic.h \
errors.h toplev.h function.h $(TIMEVAR_H) \
......
......@@ -5827,6 +5827,18 @@ Small integer constants can use a shared data structure, reducing the
compiler's memory usage and increasing its speed. This sets the maximum
value of a shared integer constant's. The default value is 256.
@item min-virtual-mappings
Specifies the minimum number of virtual mappings in the incremental
SSA updater that should be registered to trigger the virtual mappings
heuristic defined by virtual-mappings-ratio. The default value is
100.
@item virtual-mappings-ratio
If the number of virtual mappings is virtual-mappings-ratio bigger
than the number of virtual symbols to be updated, then the incremental
SSA updater switches to a full update for those symbols. The default
ratio is 3.
@end table
@end table
......
......@@ -2443,7 +2443,9 @@ perfect_nestify (struct loops *loops,
incremented when we do. */
for (bsi = bsi_start (bbs[i]); !bsi_end_p (bsi);)
{
tree stmt = bsi_stmt (bsi);
ssa_op_iter i;
tree n, stmt = bsi_stmt (bsi);
if (stmt == exit_condition
|| not_interesting_stmt (stmt)
|| stmt_is_bumper_for_loop (loop, stmt))
......@@ -2451,11 +2453,19 @@ perfect_nestify (struct loops *loops,
bsi_next (&bsi);
continue;
}
replace_uses_of_x_with_y (stmt, oldivvar, ivvar);
bsi_move_before (&bsi, &tobsi);
/* If the statement has any virtual operands, they may
need to be rewired because the original loop may
still reference them. */
FOR_EACH_SSA_TREE_OPERAND (n, stmt, i, SSA_OP_ALL_VIRTUALS)
mark_sym_for_renaming (SSA_NAME_VAR (n));
}
}
}
free (bbs);
return perfect_nest_p (loop);
}
......
......@@ -443,6 +443,30 @@ DEFPARAM (PARAM_INTEGER_SHARE_LIMIT,
"The upper bound for sharing integer constants",
256, 2, 2)
/* Incremental SSA updates for virtual operands may be very slow if
there is a large number of mappings to process. In those cases, it
is faster to rewrite the virtual symbols from scratch as if they
had been recently introduced. This heuristic cannot be applied to
SSA mappings for real SSA names, only symbols kept in FUD chains.
PARAM_MIN_VIRTUAL_MAPPINGS specifies the minimum number of virtual
mappings that should be registered to trigger the heuristic.
PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO specifies the ratio between
mappings and symbols. If the number of virtual mappings is
PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO bigger than the number of
virtual symbols to be updated, then the updater switches to a full
update for those symbols. */
DEFPARAM (PARAM_MIN_VIRTUAL_MAPPINGS,
"min-virtual-mappings",
"Minimum number of virtual mappings to consider switching to full virtual renames",
100, 0, 0)
DEFPARAM (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO,
"virtual-mappings-ratio",
"Ratio between virtual mappings and virtual symbols to do full virtual renames",
3, 0, 0)
/*
Local variables:
mode:c
......
......@@ -139,4 +139,8 @@ typedef enum compiler_param
PARAM_VALUE (PARAM_INTEGER_SHARE_LIMIT)
#define MAX_LAST_VALUE_RTL \
PARAM_VALUE (PARAM_MAX_LAST_VALUE_RTL)
#define MIN_VIRTUAL_MAPPINGS \
PARAM_VALUE (PARAM_MIN_VIRTUAL_MAPPINGS)
#define VIRTUAL_MAPPINGS_TO_SYMS_RATIO \
PARAM_VALUE (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO)
#endif /* ! GCC_PARAMS_H */
2005-04-22 Diego Novillo <dnovillo@redhat.com>
* gcc.dg/tree-ssa/ltrans-4.c: Fix typo in dg-options.
2005-04-22 Jeff Law <law@redhat.com>
* gcc.dg/uninit-5.c: Remove xfails.
......
/* { dg-do compile } */
/* { dg-options "-O20 -ftree-loop-linear -fdump-tree-ltrans-all" } */
/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */
double u[1782225];
int foo(int N, int *res)
......
......@@ -253,15 +253,11 @@ struct var_ann_d GTY(())
tree default_def;
/* During into-ssa and the dominator optimizer, this field holds the
current version of this variable (an SSA_NAME).
This was previously two varrays (one in into-ssa the other in the
dominator optimizer). That is wasteful, particularly since the
dominator optimizer calls into-ssa resulting in having two varrays
live at the same time and this can happen for each call to the
dominator optimizer. */
current version of this variable (an SSA_NAME). */
tree current_def;
/* If this variable is a structure, this fields holds a list of
symbols representing each of the fields of the structure. */
subvar_t subvars;
};
......@@ -540,9 +536,6 @@ extern bool tree_duplicate_sese_region (edge, edge, basic_block *, unsigned,
basic_block *);
extern void add_phi_args_after_copy_bb (basic_block);
extern void add_phi_args_after_copy (basic_block *, unsigned);
extern void rewrite_to_new_ssa_names_bb (basic_block, struct htab *);
extern void rewrite_to_new_ssa_names (basic_block *, unsigned, htab_t);
extern void allocate_ssa_names (bitmap, struct htab **);
extern bool tree_purge_dead_eh_edges (basic_block);
extern bool tree_purge_all_dead_eh_edges (bitmap);
extern tree gimplify_val (block_stmt_iterator *, tree, tree);
......@@ -565,7 +558,6 @@ extern tree create_phi_node (tree, basic_block);
extern void add_phi_arg (tree, tree, edge);
extern void remove_phi_args (edge);
extern void remove_phi_node (tree, tree);
extern tree find_phi_node_for (basic_block, tree, tree *);
extern tree phi_reverse (tree);
extern void dump_dfa_stats (FILE *);
extern void debug_dfa_stats (void);
......@@ -612,11 +604,6 @@ typedef bool (*walk_use_def_chains_fn) (tree, tree, void *);
/* In tree-ssa.c */
extern void init_tree_ssa (void);
extern void dump_tree_ssa (FILE *);
extern void debug_tree_ssa (void);
extern void debug_def_blocks (void);
extern void dump_tree_ssa_stats (FILE *);
extern void debug_tree_ssa_stats (void);
extern edge ssa_redirect_edge (edge, basic_block);
extern void flush_pending_stmts (edge);
extern bool tree_ssa_useless_type_conversion (tree);
......@@ -628,23 +615,20 @@ extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
extern bool stmt_references_memory_p (tree);
/* In tree-into-ssa.c */
extern void rewrite_ssa_into_ssa (void);
void update_ssa (unsigned);
void delete_update_ssa (void);
void register_new_name_mapping (tree, tree);
tree create_new_def_for (tree, tree, def_operand_p);
bool need_ssa_update_p (void);
bool name_registered_for_update_p (tree);
bitmap ssa_names_to_replace (void);
void release_ssa_name_after_update_ssa (tree name);
void dump_repl_tbl (FILE *);
void debug_repl_tbl (void);
void dump_names_replaced_by (FILE *, tree);
void debug_names_replaced_by (tree);
void compute_global_livein (bitmap, bitmap);
tree duplicate_ssa_name (tree, tree);
void mark_sym_for_renaming (tree);
void mark_set_for_renaming (bitmap);
tree get_current_def (tree);
void set_current_def (tree, tree);
/* In tree-ssa-ccp.c */
bool fold_stmt (tree *);
......@@ -724,7 +708,7 @@ tree find_loop_niter_by_eval (struct loop *, edge *);
void estimate_numbers_of_iterations (struct loops *);
tree can_count_iv_in_wider_type (struct loop *, tree, tree, tree, tree);
void free_numbers_of_iterations_estimates (struct loops *);
void rewrite_into_loop_closed_ssa (bitmap);
void rewrite_into_loop_closed_ssa (bitmap, unsigned);
void verify_loop_closed_ssa (void);
void loop_commit_inserts (void);
bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
......
......@@ -373,6 +373,5 @@ linear_transform_loops (struct loops *loops)
VEC_free (tree, heap, oldivs);
VEC_free (tree, heap, invariants);
scev_reset ();
update_ssa (TODO_update_ssa);
rewrite_into_loop_closed_ssa (NULL);
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa_full_phi);
}
......@@ -466,30 +466,6 @@ remove_phi_node (tree phi, tree prev)
}
/* Find the first PHI node P in basic block BB for symbol SYM. If
PREV_P is given, the PHI node preceding P is stored in *PREV_P. */
tree
find_phi_node_for (basic_block bb, tree sym, tree *prev_p)
{
tree phi;
if (prev_p)
*prev_p = NULL_TREE;
for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
{
if (SSA_NAME_VAR (PHI_RESULT (phi)) == sym)
return phi;
if (prev_p)
*prev_p = phi;
}
return NULL_TREE;
}
/* Reverse the order of PHI nodes in the chain PHI.
Return the new head of the chain (old last PHI node). */
......
......@@ -474,7 +474,7 @@ tree_ssa_dominator_optimize (void)
calculate_dominance_info (CDI_DOMINATORS);
rewrite_ssa_into_ssa ();
update_ssa (TODO_update_ssa);
/* Reinitialize the various tables. */
bitmap_clear (nonzero_vars);
......
......@@ -136,7 +136,7 @@ copy_loop_headers (void)
loops = loop_optimizer_init (dump_file);
if (!loops)
return;
rewrite_into_loop_closed_ssa (NULL);
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
/* We do not try to keep the information about irreducible regions
up-to-date. */
......
......@@ -757,14 +757,8 @@ move_computations (void)
fini_walk_dominator_tree (&walk_data);
loop_commit_inserts ();
if (need_ssa_update_p ())
update_ssa (TODO_update_ssa);
/* The movement of LI code may cause violation of loop closed SSA
form invariants. TODO -- avoid these rewrites completely.
Information in virtual phi nodes is sufficient for it. */
rewrite_into_loop_closed_ssa (NULL);
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
}
/* Checks whether the statement defining variable *INDEX can be hoisted
......
......@@ -185,6 +185,8 @@ try_unroll_loop_completely (struct loops *loops ATTRIBUTE_UNUSED,
COND_EXPR_COND (cond) = do_exit;
update_stmt (cond);
update_ssa (TODO_update_ssa);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Unrolled loop %d completely.\n", loop->num);
......
......@@ -5416,10 +5416,8 @@ tree_ssa_iv_optimize (struct loops *loops)
FOR_EACH_BB (bb)
for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
update_stmt (bsi_stmt (si));
update_ssa (TODO_update_ssa);
}
rewrite_into_loop_closed_ssa (NULL);
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
tree_ssa_iv_optimize_finalize (loops, &data);
}
......@@ -101,10 +101,6 @@ tree_ssa_unswitch_loops (struct loops *loops)
continue;
changed |= tree_unswitch_single_loop (loops, loop, 0);
#ifdef ENABLE_CHECKING
verify_dominators (CDI_DOMINATORS);
verify_loop_structure (loops);
#endif
}
if (changed)
......@@ -260,6 +256,9 @@ tree_unswitch_single_loop (struct loops *loops, struct loop *loop, int num)
if (!nloop)
return changed;
/* Update the SSA form after unswitching. */
update_ssa (TODO_update_ssa);
/* Invoke itself on modified loops. */
tree_unswitch_single_loop (loops, nloop, num + 1);
tree_unswitch_single_loop (loops, loop, num + 1);
......
......@@ -40,7 +40,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* The loop tree currently optimized. */
struct loops *current_loops;
struct loops *current_loops = NULL;
/* Initializes the loop structures. DUMP is the file to that the details
about the analysis should be dumped. */
......@@ -53,8 +53,7 @@ tree_loop_optimizer_init (FILE *dump)
if (!loops)
return NULL;
update_ssa (TODO_update_ssa);
rewrite_into_loop_closed_ssa (NULL);
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
return loops;
}
......
......@@ -644,6 +644,10 @@ verify_ssa (bool check_modified_stmt)
enum dom_state orig_dom_state = dom_computed[CDI_DOMINATORS];
bitmap names_defined_in_bb = BITMAP_ALLOC (NULL);
gcc_assert (!need_ssa_update_p ());
verify_stmts ();
timevar_push (TV_TREE_SSA_VERIFY);
/* Keep track of SSA names present in the IL. */
......@@ -751,9 +755,7 @@ verify_ssa (bool check_modified_stmt)
}
FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_ALL_DEFS)
{
bitmap_set_bit (names_defined_in_bb, SSA_NAME_VERSION (op));
}
bitmap_set_bit (names_defined_in_bb, SSA_NAME_VERSION (op));
}
bitmap_clear (names_defined_in_bb);
......@@ -763,6 +765,7 @@ verify_ssa (bool check_modified_stmt)
verify_alias_info ();
free (definition_block);
/* Restore the dominance information to its prior known state, so
that we do not perturb the compiler's subsequent behavior. */
if (orig_dom_state == DOM_NONE)
......@@ -835,6 +838,7 @@ delete_tree_ssa (void)
addressable_vars = NULL;
modified_noreturn_calls = NULL;
aliases_computed_p = false;
gcc_assert (!need_ssa_update_p ());
}
......
......@@ -61,9 +61,6 @@ Boston, MA 02111-1307, USA. */
/* Array of all SSA_NAMEs used in the function. */
varray_type ssa_names;
/* Bitmap of ssa names marked for rewriting. */
static bitmap ssa_names_to_rewrite;
/* Free list of SSA_NAMEs. This list is wiped at the end of each function
after we leave SSA form. */
static GTY (()) tree free_ssanames;
......@@ -77,54 +74,6 @@ unsigned int ssa_name_nodes_reused;
unsigned int ssa_name_nodes_created;
#endif
/* Returns true if ssa name VAR is marked for rewrite. */
bool
marked_for_rewrite_p (tree var)
{
return bitmap_bit_p (ssa_names_to_rewrite, SSA_NAME_VERSION (var));
}
/* Returns true if any ssa name is marked for rewrite. */
bool
any_marked_for_rewrite_p (void)
{
if (!ssa_names_to_rewrite)
return false;
return !bitmap_empty_p (ssa_names_to_rewrite);
}
/* Mark ssa name VAR for rewriting. */
void
mark_for_rewrite (tree var)
{
bitmap_set_bit (ssa_names_to_rewrite, SSA_NAME_VERSION (var));
}
/* Unmark all ssa names marked for rewrite. */
void
unmark_all_for_rewrite (void)
{
bitmap_clear (ssa_names_to_rewrite);
}
/* Return the bitmap of ssa names to rewrite. Copy the bitmap,
so that the optimizers cannot access internals directly */
bitmap
marked_ssa_names (void)
{
bitmap ret = BITMAP_ALLOC (NULL);
bitmap_copy (ret, ssa_names_to_rewrite);
return ret;
}
/* Initialize management of SSA_NAMEs. */
void
......@@ -138,7 +87,6 @@ init_ssanames (void)
large. */
VARRAY_PUSH_TREE (ssa_names, NULL_TREE);
free_ssanames = NULL;
ssa_names_to_rewrite = BITMAP_ALLOC (NULL);
}
/* Finalize management of SSA_NAMEs. */
......@@ -146,7 +94,6 @@ init_ssanames (void)
void
fini_ssanames (void)
{
BITMAP_FREE (ssa_names_to_rewrite);
ggc_free (ssa_names);
ssa_names = NULL;
free_ssanames = NULL;
......@@ -237,11 +184,13 @@ release_ssa_name (tree var)
if (var == var_ann (SSA_NAME_VAR (var))->default_def)
return;
/* If the ssa name is marked for rewriting, it may have multiple definitions,
but we may happen to remove just one of them. So do not remove the
ssa name now. */
if (marked_for_rewrite_p (var))
return;
/* If VAR has been registered for SSA updating, don't remove it.
After update_ssa has run, the name will be released. */
if (name_registered_for_update_p (var))
{
release_ssa_name_after_update_ssa (var);
return;
}
/* release_ssa_name can be called multiple times on a single SSA_NAME.
However, it should only end up on our free list one time. We
......@@ -304,7 +253,7 @@ duplicate_ssa_name (tree name, tree stmt)
/* Creates a duplicate of the ptr_info_def at PTR_INFO for use by
the ssa name NAME. */
the SSA name NAME. */
void
duplicate_ssa_name_ptr_info (tree name, struct ptr_info_def *ptr_info)
......
......@@ -1991,6 +1991,11 @@ vect_transform_loop (loop_vec_info loop_vinfo,
slpeel_make_loop_iterate_ntimes (loop, ratio);
/* The memory tags and pointers in vectorized statements need to
have their SSA forms updated. FIXME, why can't this be delayed
until all the loops have been transformed? */
update_ssa (TODO_update_ssa);
if (vect_print_dump_info (REPORT_VECTORIZED_LOOPS, LOOP_LOC (loop_vinfo)))
fprintf (vect_dump, "LOOP VECTORIZED.");
}
......@@ -2833,13 +2833,6 @@ extern void replace_ssa_name_symbol (tree, tree);
extern void ssanames_print_statistics (void);
#endif
extern void mark_for_rewrite (tree);
extern void unmark_all_for_rewrite (void);
extern bool marked_for_rewrite_p (tree);
extern bool any_marked_for_rewrite_p (void);
extern struct bitmap_head_def *marked_ssa_names (void);
/* Return the (unique) IDENTIFIER_NODE node for a given name.
The name is supplied as a char *. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment