* [PATCH] Fix PR47046: correct evolution_function_is_affine_p
@ 2011-07-25 23:03 Sebastian Pop
2011-07-26 9:01 ` Richard Guenther
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Pop @ 2011-07-25 23:03 UTC (permalink / raw)
To: gcc-patches; +Cc: rguenther, Sebastian Pop
"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-23 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.
---
gcc/ChangeLog | 6 ++++++
gcc/testsuite/ChangeLog | 5 +++++
gcc/testsuite/gcc.dg/graphite/id-pr47046.c | 13 +++++++++++++
gcc/tree-chrec.h | 4 +++-
4 files changed, 27 insertions(+), 1 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/graphite/id-pr47046.c
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index feffc6b..2237954 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2011-07-23 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-23 Sebastian Pop <sebastian.pop@amd.com>
+
PR middle-end/47594
* graphite-sese-to-poly.c (scan_tree_for_params_right_scev): Sign
extend constants.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index af1211a..919484b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2011-07-23 Sebastian Pop <sebastian.pop@amd.com>
+ PR middle-end/47046
+ * gcc.dg/graphite/id-pr47046.c: New.
+
+2011-07-23 Sebastian Pop <sebastian.pop@amd.com>
+
PR middle-end/47594
* gfortran.dg/graphite/run-id-pr47594.f90: New.
diff --git a/gcc/testsuite/gcc.dg/graphite/id-pr47046.c b/gcc/testsuite/gcc.dg/graphite/id-pr47046.c
new file mode 100644
index 0000000..aba38ed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-pr47046.c
@@ -0,0 +1,13 @@
+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;
+ }
+}
+
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
index b9bf71e..9b971bd 100644
--- a/gcc/tree-chrec.h
+++ b/gcc/tree-chrec.h
@@ -205,7 +205,9 @@ evolution_function_is_affine_p (const_tree chrec)
return chrec
&& TREE_CODE (chrec) == POLYNOMIAL_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. */
--
1.7.4.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix PR47046: correct evolution_function_is_affine_p
2011-07-25 23:03 [PATCH] Fix PR47046: correct evolution_function_is_affine_p Sebastian Pop
@ 2011-07-26 9:01 ` Richard Guenther
0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2011-07-26 9:01 UTC (permalink / raw)
To: Sebastian Pop; +Cc: gcc-patches
[-- Attachment #1: Type: TEXT/PLAIN, Size: 4104 bytes --]
On Mon, 25 Jul 2011, Sebastian Pop wrote:
> "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.
Ok.
Thanks,
Richard.
> 2011-07-23 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.
> ---
> gcc/ChangeLog | 6 ++++++
> gcc/testsuite/ChangeLog | 5 +++++
> gcc/testsuite/gcc.dg/graphite/id-pr47046.c | 13 +++++++++++++
> gcc/tree-chrec.h | 4 +++-
> 4 files changed, 27 insertions(+), 1 deletions(-)
> create mode 100644 gcc/testsuite/gcc.dg/graphite/id-pr47046.c
>
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index feffc6b..2237954 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,5 +1,11 @@
> 2011-07-23 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-23 Sebastian Pop <sebastian.pop@amd.com>
> +
> PR middle-end/47594
> * graphite-sese-to-poly.c (scan_tree_for_params_right_scev): Sign
> extend constants.
> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
> index af1211a..919484b 100644
> --- a/gcc/testsuite/ChangeLog
> +++ b/gcc/testsuite/ChangeLog
> @@ -1,5 +1,10 @@
> 2011-07-23 Sebastian Pop <sebastian.pop@amd.com>
>
> + PR middle-end/47046
> + * gcc.dg/graphite/id-pr47046.c: New.
> +
> +2011-07-23 Sebastian Pop <sebastian.pop@amd.com>
> +
> PR middle-end/47594
> * gfortran.dg/graphite/run-id-pr47594.f90: New.
>
> diff --git a/gcc/testsuite/gcc.dg/graphite/id-pr47046.c b/gcc/testsuite/gcc.dg/graphite/id-pr47046.c
> new file mode 100644
> index 0000000..aba38ed
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/graphite/id-pr47046.c
> @@ -0,0 +1,13 @@
> +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;
> + }
> +}
> +
> diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
> index b9bf71e..9b971bd 100644
> --- a/gcc/tree-chrec.h
> +++ b/gcc/tree-chrec.h
> @@ -205,7 +205,9 @@ evolution_function_is_affine_p (const_tree chrec)
> return chrec
> && TREE_CODE (chrec) == POLYNOMIAL_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. */
>
--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-26 8:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-25 23:03 [PATCH] Fix PR47046: correct evolution_function_is_affine_p Sebastian Pop
2011-07-26 9:01 ` Richard Guenther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).