diff options
author | Tom de Vries <tom@codesourcery.com> | 2011-05-19 08:49:28 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2011-05-19 08:49:28 +0000 |
commit | a53c50249f684027ef6ca3957b0811e4ecb233e7 (patch) | |
tree | f13f50496860123c6188318e07c9afc090ed8d7c | |
parent | 5bbe9958e05e80c215373311963ec9c31751ebca (diff) | |
download | gcc-a53c50249f684027ef6ca3957b0811e4ecb233e7.zip gcc-a53c50249f684027ef6ca3957b0811e4ecb233e7.tar.gz gcc-a53c50249f684027ef6ca3957b0811e4ecb233e7.tar.bz2 |
re PR middle-end/45098 (Missed induction variable optimization)
2011-05-19 Tom de Vries <tom@codesourcery.com>
PR target/45098
* tree-ssa-loop-ivopts.c (determine_iv_cost): Prevent
cost_base.cost == 0.
From-SVN: r173893
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c695f9b..a3ce4ef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-05-19 Tom de Vries <tom@codesourcery.com> + + PR target/45098 + * tree-ssa-loop-ivopts.c (determine_iv_cost): Prevent + cost_base.cost == 0. + 2011-05-18 H.J. Lu <hongjiu.lu@intel.com> PR target/49002 diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 501dbbf..1580aec 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -4690,6 +4690,11 @@ determine_iv_cost (struct ivopts_data *data, struct iv_cand *cand) base = cand->iv->base; cost_base = force_var_cost (data, base, NULL); + /* It will be exceptional that the iv register happens to be initialized with + the proper value at no cost. In general, there will at least be a regcopy + or a const set. */ + if (cost_base.cost == 0) + cost_base.cost = COSTS_N_INSNS (1); cost_step = add_cost (TYPE_MODE (TREE_TYPE (base)), data->speed); cost = cost_step + adjust_setup_cost (data, cost_base.cost); |