aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authorZdenek Dvorak <dvorakz@suse.cz>2007-04-17 18:42:29 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2007-04-17 16:42:29 +0000
commita154b43a811a710525c1da93ea4f97c97c9327f9 (patch)
tree0a31c59ebc8695e61c56119d3a3890c7117e0a43 /gcc/tree-ssa-loop-ivopts.c
parentfaf28b3a89f32229935b0f60383423315121eb8d (diff)
downloadgcc-a154b43a811a710525c1da93ea4f97c97c9327f9.zip
gcc-a154b43a811a710525c1da93ea4f97c97c9327f9.tar.gz
gcc-a154b43a811a710525c1da93ea4f97c97c9327f9.tar.bz2
re PR rtl-optimization/31360 (RTL loop invariant is not aggressive enough)
PR rtl-optimization/31360 * cfgloopanal.c (target_small_cost, target_pres_cost): Removed. (target_reg_cost): New. (init_set_costs): Initialize target_reg_cost. Add comments regarding the rationale of the costs. (global_cost_for_size): Renamed to... (estimate_reg_pressure_cost): ... and simplify. Decrease importance of register pressure. * tree-ssa-loop-ivopts.c (ivopts_global_cost_for_size): Use estimate_reg_pressure_cost. Add number of ivs. (determine_set_costs): Dump target_reg_cost. * loop-invariant.c (gain_for_invariant): Use estimate_reg_pressure_cost. Removed n_inv_uses argument. (best_gain_for_invariant, find_invariants_to_move): Remove n_inv_uses. * cfgloop.h (target_small_cost, target_pres_cost): Removed. (target_reg_cost): Declare. (global_cost_for_size): Declaration removed. (estimate_reg_pressure_cost): Declare. * gcc.dg/loop-7.c: New test. From-SVN: r123919
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r--gcc/tree-ssa-loop-ivopts.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 6e952af..d26608b 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -3908,7 +3908,9 @@ determine_iv_costs (struct ivopts_data *data)
static unsigned
ivopts_global_cost_for_size (struct ivopts_data *data, unsigned size)
{
- return global_cost_for_size (size, data->regs_used, n_iv_uses (data));
+ /* We add size to the cost, so that we prefer eliminating ivs
+ if possible. */
+ return size + estimate_reg_pressure_cost (size, data->regs_used);
}
/* For each size of the induction variable set determine the penalty. */
@@ -3945,8 +3947,7 @@ determine_set_costs (struct ivopts_data *data)
{
fprintf (dump_file, "Global costs:\n");
fprintf (dump_file, " target_avail_regs %d\n", target_avail_regs);
- fprintf (dump_file, " target_small_cost %d\n", target_small_cost);
- fprintf (dump_file, " target_pres_cost %d\n", target_pres_cost);
+ fprintf (dump_file, " target_reg_cost %d\n", target_reg_cost);
fprintf (dump_file, " target_spill_cost %d\n", target_spill_cost);
}