Sorry for being so late.  I was just curious...

Tom de Vries <vr...@codesourcery.com> writes:
> The init cost of an iv will in general not be zero. It will be
> exceptional that the iv register happens to be initialized with the
> proper value at no cost. In general, there will at the very least be a
> regcopy or a const set.
>
> 2011-05-05  Tom de Vries  <t...@codesourcery.com>
>
>       PR target/45098
>       * tree-ssa-loop-ivopts.c (determine_iv_cost): Prevent
>       cost_base.cost == 0.
> Index: gcc/tree-ssa-loop-ivopts.c
> ===================================================================
> --- gcc/tree-ssa-loop-ivopts.c        (revision 173380)
> +++ gcc/tree-ssa-loop-ivopts.c        (working copy)
> @@ -4688,6 +4688,8 @@ determine_iv_cost (struct ivopts_data *d
>  
>    base = cand->iv->base;
>    cost_base = force_var_cost (data, base, NULL);
> +  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);

...why does this reasoning apply only to this call to force_var_cost?

Richard

Reply via email to