http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48702

--- Comment #15 from rakdver at kam dot mff.cuni.cz <rakdver at kam dot 
mff.cuni.cz> 2011-05-17 19:26:18 UTC ---
Hi,

> The following patch fixes the problem. Is it ok?

as a heuristic, this probably makes sense.  Still, it does
not fix the problem, just masks it and makes it harder to reproduce,

Zdenek

> David
> 
> 
> --- tree-ssa-loop-ivopts.c      (revision 173278)
> +++ tree-ssa-loop-ivopts.c      (working copy)
> @@ -3968,7 +3968,7 @@ get_computation_cost_at (struct ivopts_d
>                           int *inv_expr_id)
>  {
>    tree ubase = use->iv->base, ustep = use->iv->step;
> -  tree cbase, cstep;
> +  tree cbase, cstep, cbase_strip;
>    tree utype = TREE_TYPE (ubase), ctype;
>    unsigned HOST_WIDE_INT cstepi, offset = 0;
>    HOST_WIDE_INT ratio, aratio;
> @@ -4026,6 +4026,13 @@ get_computation_cost_at (struct ivopts_d
>    if (!constant_multiple_of (ustep, cstep, &rat))
>      return infinite_cost;
> 
> +  cbase_strip = STRIP_NOPS (cbase);
> +  /* Avoid confusing aliaser.  */
> +  if (TREE_CODE (cbase_strip) == ADDR_EXPR
> +      && TREE_CODE (TREE_OPERAND (cbase_strip, 0)) == VAR_DECL
> +      && (HOST_WIDE_INT) cstepi < 0)
> +    return infinite_cost;
> +
>    if (double_int_fits_in_shwi_p (rat))
>      ratio = double_int_to_shwi (rat);
>    else
> 
> -- 
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.

Reply via email to