Commit 2c08497a by Bernd Schmidt Committed by Bernd Schmidt

tree-dfa.c (renumber_gimple_stmt_uids_in_blocks): New function.

	* tree-dfa.c (renumber_gimple_stmt_uids_in_blocks): New function.
	* tree-flow.h (renumber_gimple_stmt_uids_in_blocks): Declare it.
	* tree-ssa-loop-ivopts.c (comp_cost): Make COST an integer.
	(enum iv_position): Add IP_AFTER_USE and IP_BEFORE_USE.
	(dump_cand): Handle them.
	(struct iv_cand): New members COST_STEP and AINC_USE.
	(stmt_after_increment): Likewise.
	(stmt_after_inc_pos): Renamed from stmt_after_ip_original_pos.  All
	callers changed.  Use gimple_uid comparison instead of scanning.
	(add_candidate_1): When looking for identical candidates, take
	AINC_USE into account.  Set it for new candidates.
	(force_expr_to_var_cost): Cast target_spill_cost to int.
	(get_address_cost): New arguments STMT_AFTER_INC and MAY_AUTOINC.
	All callers changed.  Check for availability of autoinc addressing
	modes, both in general for a given mode, and in the specific use
	case.
	(get_computation_cost_at): New argument CAN_AUTOINC.  All callers
	changed.
	(get_computation_cost): Likewise.
	(autoinc_possible_for_pair, set_autoinc_for_original_candidates,
	add_autoinc_candidates): New static functions.
	(add_candidate): Call add_autoinc_candidates for candidates based on
	a USE_ADDRESS use.
	(find_iv_candidates): Call set_autoinc_for_original_candidates.
	(determine_use_iv_cost_address): If we have an autoinc candidate at
	the matching use, verify autoinc is possible and subtract the cost
	of the candidate's step from the cost.
	(determine_iv_cost): Record the cost of the increment in the COST_STEP
	member of the candidate.
	(tree_ssa_iv_optimize_loop): Swap the calls to determine_iv_costs and
	determine_use_iv_costs.  Call renumber_gimple_stmt_uids_in_blocks.

testsuite/
	* gcc.target/bfin/loop-autoinc.c: New file.

From-SVN: r150588
parent a9a25daa
2009-08-09 Bernd Schmidt <bernd.schmidt@analog.com>
* tree-dfa.c (renumber_gimple_stmt_uids_in_blocks): New function.
* tree-flow.h (renumber_gimple_stmt_uids_in_blocks): Declare it.
* tree-ssa-loop-ivopts.c (comp_cost): Make COST an integer.
(enum iv_position): Add IP_AFTER_USE and IP_BEFORE_USE.
(dump_cand): Handle them.
(struct iv_cand): New members COST_STEP and AINC_USE.
(stmt_after_increment): Likewise.
(stmt_after_inc_pos): Renamed from stmt_after_ip_original_pos. All
callers changed. Use gimple_uid comparison instead of scanning.
(add_candidate_1): When looking for identical candidates, take
AINC_USE into account. Set it for new candidates.
(force_expr_to_var_cost): Cast target_spill_cost to int.
(get_address_cost): New arguments STMT_AFTER_INC and MAY_AUTOINC.
All callers changed. Check for availability of autoinc addressing
modes, both in general for a given mode, and in the specific use
case.
(get_computation_cost_at): New argument CAN_AUTOINC. All callers
changed.
(get_computation_cost): Likewise.
(autoinc_possible_for_pair, set_autoinc_for_original_candidates,
add_autoinc_candidates): New static functions.
(add_candidate): Call add_autoinc_candidates for candidates based on
a USE_ADDRESS use.
(find_iv_candidates): Call set_autoinc_for_original_candidates.
(determine_use_iv_cost_address): If we have an autoinc candidate at
the matching use, verify autoinc is possible and subtract the cost
of the candidate's step from the cost.
(determine_iv_cost): Record the cost of the increment in the COST_STEP
member of the candidate.
(tree_ssa_iv_optimize_loop): Swap the calls to determine_iv_costs and
determine_use_iv_costs. Call renumber_gimple_stmt_uids_in_blocks.
2009-08-09 Douglas B Rupp <rupp@gnat.com>
* config.build (ia64-hp-*vms*): New target.
......
2009-08-09 Bernd Schmidt <bernd.schmidt@analog.com>
* gcc.target/bfin/loop-autoinc.c: New file.
2009-08-08 Richard Guenther <rguenther@suse.de>
PR tree-optimization/40991
......
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler " = \\\[\[PI\].\\+\\+\\\];" } } */
extern int x[];
extern void bar();
int foo ()
{
int i;
int sum = 0;
for (i = 0; i < 100; i++) {
sum += x[i];
if (sum & 1)
sum *= sum;
}
return sum;
}
......@@ -157,6 +157,32 @@ renumber_gimple_stmt_uids (void)
}
}
/* Like renumber_gimple_stmt_uids, but only do work on the basic blocks
in BLOCKS, of which there are N_BLOCKS. Also renumbers PHIs. */
void
renumber_gimple_stmt_uids_in_blocks (basic_block *blocks, int n_blocks)
{
int i;
set_gimple_stmt_max_uid (cfun, 0);
for (i = 0; i < n_blocks; i++)
{
basic_block bb = blocks[i];
gimple_stmt_iterator bsi;
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
}
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
}
}
}
/* Create a new annotation for a tree T. */
tree_ann_common_t
......
......@@ -554,6 +554,7 @@ extern const char *op_symbol_code (enum tree_code);
/* In tree-dfa.c */
extern var_ann_t create_var_ann (tree);
extern void renumber_gimple_stmt_uids (void);
extern void renumber_gimple_stmt_uids_in_blocks (basic_block *, int);
extern tree_ann_common_t create_tree_common_ann (tree);
extern void dump_dfa_stats (FILE *);
extern void debug_dfa_stats (void);
......
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