diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-12-25 22:53:54 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-12-25 22:53:54 +0000 |
commit | d4caf09917a055d61d63e9c8f320cd3f0fbf1b03 (patch) | |
tree | dd158a2937b61524aac9d3dd24821202ba8b51d8 /gcc/tree-ssa-loop-ivopts.c | |
parent | 285244f6b309e741d15f7f5d4556a58b72225847 (diff) | |
download | gcc-d4caf09917a055d61d63e9c8f320cd3f0fbf1b03.tar.gz |
PR rtl-optimization/19078
* tree-ssa-loop-ivopts.c (determine_use_iv_cost_generic,
determine_use_iv_cost_outer): Fix computing of cost for the original
bivs.
(dump_use): Handle case related_cands == NULL.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92608 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index d1a1bdd910a..73034127a7c 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -444,8 +444,11 @@ dump_use (FILE *file, struct iv_use *use) dump_iv (file, use->iv); - fprintf (file, " related candidates "); - dump_bitmap (file, use->related_cands); + if (use->related_cands) + { + fprintf (file, " related candidates "); + dump_bitmap (file, use->related_cands); + } } /* Dumps information about the uses to FILE. */ @@ -3116,8 +3119,20 @@ determine_use_iv_cost_generic (struct ivopts_data *data, struct iv_use *use, struct iv_cand *cand) { bitmap depends_on; - unsigned cost = get_computation_cost (data, use, cand, false, &depends_on); + unsigned cost; + + /* The simple case first -- if we need to express value of the preserved + original biv, the cost is 0. This also prevents us from counting the + cost of increment twice -- once at this use and once in the cost of + the candidate. */ + if (cand->pos == IP_ORIGINAL + && cand->incremented_at == use->stmt) + { + set_use_iv_cost (data, use, cand, 0, NULL); + return true; + } + cost = get_computation_cost (data, use, cand, false, &depends_on); set_use_iv_cost (data, use, cand, cost, depends_on); return cost != INFTY; @@ -3311,7 +3326,18 @@ determine_use_iv_cost_outer (struct ivopts_data *data, edge exit; tree value; struct loop *loop = data->current_loop; - + + /* The simple case first -- if we need to express value of the preserved + original biv, the cost is 0. This also prevents us from counting the + cost of increment twice -- once at this use and once in the cost of + the candidate. */ + if (cand->pos == IP_ORIGINAL + && cand->incremented_at == use->stmt) + { + set_use_iv_cost (data, use, cand, 0, NULL); + return true; + } + if (!cand->iv) { if (!may_replace_final_value (loop, use, &value)) |