summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authorvries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-19 08:49:28 +0000
committervries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-19 08:49:28 +0000
commitee36045b81d96bf80a18b27a14f4f72fb79e4546 (patch)
treef13f50496860123c6188318e07c9afc090ed8d7c /gcc/tree-ssa-loop-ivopts.c
parentbdc52dc844442dc1708269632d9fdbd0b08c3420 (diff)
downloadgcc-ee36045b81d96bf80a18b27a14f4f72fb79e4546.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173893 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r--gcc/tree-ssa-loop-ivopts.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 501dbbf4526..1580aec006a 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);