On Mon, Nov 6, 2017 at 9:12 PM, Richard Sandiford
<richard.sandif...@linaro.org> wrote:
> initialize_matrix_A requires the CHREC_RIGHT to be an INTEGER_CST:
>
>   switch (TREE_CODE (chrec))
>     {
>     case POLYNOMIAL_CHREC:
>       A[index][0] = mult * int_cst_value (CHREC_RIGHT (chrec));
>       return initialize_matrix_A (A, CHREC_LEFT (chrec), index + 1, mult);
>
> and isn't able to back out if it isn't.  This patch instead
> checks for an appropriate CHREC_RIGHT before calling the parent
> function analyze_subscript_affine_affine.
>
> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64-linux-gnu.
> OK to install?

Hmm.  I think this papers over some underlying issues.  The calls are
guarded already with predicates that are supposed to veryify what you do.
Namely chrec_contains_symbols (a poly_int _does_ contain a "symbol").

So can you please fix that by adding TREE_CODE (chrec) == POLY_INT
to the return true case?

Thanks,
Richard.

> Richard
>
>
> 2017-11-06  Richard Sandiford  <richard.sandif...@linaro.org>
>
> gcc/
>         * tree-data-ref.c (analyze_siv_subscript): Only call
>         analyze_subscript_affine_affine on chrecs that have an
>         INTEGER_CST step.
>         (analyze_miv_subscript): Likewise.
>
> Index: gcc/tree-data-ref.c
> ===================================================================
> --- gcc/tree-data-ref.c 2017-11-06 19:39:32.924734707 +0000
> +++ gcc/tree-data-ref.c 2017-11-06 20:10:40.704478657 +0000
> @@ -3788,7 +3788,9 @@ analyze_siv_subscript (tree chrec_a,
>                                       overlaps_b, overlaps_a, last_conflicts);
>
>    else if (evolution_function_is_affine_in_loop (chrec_a, loop_nest_num)
> -          && evolution_function_is_affine_in_loop (chrec_b, loop_nest_num))
> +          && evolution_function_right_is_integer_cst (chrec_a)
> +          && evolution_function_is_affine_in_loop (chrec_b, loop_nest_num)
> +          && evolution_function_right_is_integer_cst (chrec_b))
>      {
>        if (!chrec_contains_symbols (chrec_a)
>           && !chrec_contains_symbols (chrec_b))
> @@ -3922,8 +3924,10 @@ analyze_miv_subscript (tree chrec_a,
>
>    else if (evolution_function_is_affine_multivariate_p (chrec_a, 
> loop_nest->num)
>            && !chrec_contains_symbols (chrec_a)
> +          && evolution_function_right_is_integer_cst (chrec_a)
>            && evolution_function_is_affine_multivariate_p (chrec_b, 
> loop_nest->num)
> -          && !chrec_contains_symbols (chrec_b))
> +          && !chrec_contains_symbols (chrec_b)
> +          && evolution_function_right_is_integer_cst (chrec_b))
>      {
>        /* testsuite/.../ssa-chrec-35.c
>          {0, +, 1}_2  vs.  {0, +, 1}_3

Reply via email to