Commit bce26def by Sebastian Pop Committed by Sebastian Pop

Fix PR47046: correct evolution_function_is_affine_p

"Bug 47046 - gcc.target/i386/sse4_1-movntdqa.c ICEs with -fgraphite-identity"

The problem here is that we are left with the following code to be
translated in the new representation following the transform that
Graphite has chosen:

        D.2709_14 = j_33 * i_32;
        D.2710_15 = D.2709_14 * i_32;
        D.2711_16 = D.2710_15 * sign_34;
        *D.2708_13 = D.2711_16;

In this particular case we have a nonlinear expression "i * i" for
which we have to generate code following the new graphite_iv variables.

The patch fixes the function that detects whether we are passing non
linear stuff to graphite: evolution_function_is_affine_p.  It seems
like for the moment evolution_function_is_affine_p is testing whether
an evolution function is affine only in the innermost loop, without
looking recursively at what happens in outer loops.

The chrec for this case is: {0, +, {0, +, {1, +, 2}_1}_1}_2 and we are
testing whether the evolution is affine only for the loop_2, which is
true as we have {0, +, blah}_2 with blah invariant in loop_2.

The patch adds the recursive call to evolution_function_is_affine_p.

Bootstrapped and tested on amd64-linux.

2011-07-26  Sebastian Pop  <sebastian.pop@amd.com>

	PR middle-end/47046
	* tree-chrec.h (evolution_function_is_affine_p): Recursively call
	evolution_function_is_affine_p on CHREC_RIGHT.

	* gcc.dg/graphite/id-pr47046.c: New.

From-SVN: r176805
parent 5f72e02d
2011-07-26 Sebastian Pop <sebastian.pop@amd.com> 2011-07-26 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/47046
* tree-chrec.h (evolution_function_is_affine_p): Recursively call
evolution_function_is_affine_p on CHREC_RIGHT.
2011-07-26 Sebastian Pop <sebastian.pop@amd.com>
* tree-data-ref.c (max_stmt_executions_tree): Do not call * tree-data-ref.c (max_stmt_executions_tree): Do not call
lang_hooks.types.type_for_size. lang_hooks.types.type_for_size.
......
2011-07-26 Sebastian Pop <sebastian.pop@amd.com> 2011-07-26 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/47046
* gcc.dg/graphite/id-pr47046.c: New.
2011-07-26 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/47653 PR middle-end/47653
* gcc.dg/graphite/run-id-pr47593.c: New. * gcc.dg/graphite/run-id-pr47593.c: New.
......
void
init_movntdqa (int *src)
{
int i, j, sign = 1;
for (i = 0; i < 20; i++)
for (j = 0; j < 4; j++)
{
src[i * 4 + j] = j * i * i * sign;
sign = -sign;
}
}
...@@ -205,7 +205,9 @@ evolution_function_is_affine_p (const_tree chrec) ...@@ -205,7 +205,9 @@ evolution_function_is_affine_p (const_tree chrec)
return chrec return chrec
&& TREE_CODE (chrec) == POLYNOMIAL_CHREC && TREE_CODE (chrec) == POLYNOMIAL_CHREC
&& evolution_function_is_invariant_p (CHREC_RIGHT (chrec), && evolution_function_is_invariant_p (CHREC_RIGHT (chrec),
CHREC_VARIABLE (chrec)); CHREC_VARIABLE (chrec))
&& (TREE_CODE (CHREC_RIGHT (chrec)) != POLYNOMIAL_CHREC
|| evolution_function_is_affine_p (CHREC_RIGHT (chrec)));
} }
/* Determines whether EXPR does not contains chrec expressions. */ /* Determines whether EXPR does not contains chrec expressions. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment