public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR46928: handle "A[p] == A[p]" in data dep analysis with p a parameter of the loop.
@ 2010-12-13 19:27 Sebastian Pop
  2010-12-15  2:28 ` Richard Guenther
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Pop @ 2010-12-13 19:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: rguenther, Sebastian Pop

Hi,

This patch improves the data dependence test to handle this case:

p = parameter
loop_1
  A[p] = ...
end_loop_1

this is handled as creating an overlap at every loop iteration.
Ok for trunk after this passes regression test on amd64-linux?

Thanks,
Sebastian


---
 gcc/testsuite/gcc.dg/tree-ssa/ldist-17.c |   50 ++++++++++++++++++++++++++++++
 gcc/tree-data-ref.c                      |    5 ++-
 2 files changed, 53 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ldist-17.c

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-17.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-17.c
new file mode 100644
index 0000000..a831d3c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-17.c
@@ -0,0 +1,50 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-loop-distribution -fdump-tree-ldist-details" } */
+
+typedef int mad_fixed_t;
+struct mad_pcm
+{
+  unsigned int samplerate;
+  unsigned short channels;
+  unsigned short length;
+  mad_fixed_t samples[2][1152];
+};
+struct mad_synth
+{
+  mad_fixed_t filter[2][2][2][16][8];
+  unsigned int phase;
+  struct mad_pcm pcm;
+};
+void mad_synth_mute (struct mad_synth *synth);
+void
+mad_synth_mute (struct mad_synth *synth)
+{
+  unsigned int ch;
+  unsigned int s;
+  unsigned int v;
+
+  ch = 0U;
+  while (ch < 2U)
+    {
+      s = 0U;
+      while (s < 16U)
+	{
+	  v = 0U;
+	  while (v < 8U)
+	    {
+	      synth->filter[ch][1][1][s][v] = 0;
+	      synth->filter[ch][1][0][s][v] = 0;
+	      synth->filter[ch][0][1][s][v] = 0;
+	      synth->filter[ch][0][0][s][v] = 0;
+	      v++;
+	    }
+	  s++;
+	}
+      ch++;
+    }
+  return;
+}
+
+/* { dg-final { scan-tree-dump "distributed: split to 4" "ldist" } } */
+/* { dg-final { scan-tree-dump-times "__builtin_memset" 8 "ldist" } } */
+/* { dg-final { cleanup-tree-dump "ldist" } } */
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 9a81370..a6d0731 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -2653,7 +2653,8 @@ analyze_overlapping_iterations (tree chrec_a,
   /* If they are the same chrec, and are affine, they overlap
      on every iteration.  */
   else if (eq_evolutions_p (chrec_a, chrec_b)
-	   && evolution_function_is_affine_multivariate_p (chrec_a, lnn))
+	   && (evolution_function_is_affine_multivariate_p (chrec_a, lnn)
+	       || operand_equal_p (chrec_a, chrec_b, 0)))
     {
       dependence_stats.num_same_subscript_function++;
       *overlap_iterations_a = conflict_fn (1, affine_fn_cst (integer_zero_node));
@@ -2662,7 +2663,7 @@ analyze_overlapping_iterations (tree chrec_a,
     }
 
   /* If they aren't the same, and aren't affine, we can't do anything
-     yet. */
+     yet.  */
   else if ((chrec_contains_symbols (chrec_a)
 	    || chrec_contains_symbols (chrec_b))
 	   && (!evolution_function_is_affine_multivariate_p (chrec_a, lnn)
-- 
1.7.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix PR46928: handle "A[p] == A[p]" in data dep analysis with p a parameter of the loop.
  2010-12-13 19:27 [PATCH] Fix PR46928: handle "A[p] == A[p]" in data dep analysis with p a parameter of the loop Sebastian Pop
@ 2010-12-15  2:28 ` Richard Guenther
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2010-12-15  2:28 UTC (permalink / raw)
  To: Sebastian Pop; +Cc: gcc-patches, rguenther

On Mon, Dec 13, 2010 at 7:57 PM, Sebastian Pop <sebpop@gmail.com> wrote:
> Hi,
>
> This patch improves the data dependence test to handle this case:
>
> p = parameter
> loop_1
>  A[p] = ...
> end_loop_1
>
> this is handled as creating an overlap at every loop iteration.
> Ok for trunk after this passes regression test on amd64-linux?

Ok.

Thanks,
Richard.

> Thanks,
> Sebastian
>
>
> ---
>  gcc/testsuite/gcc.dg/tree-ssa/ldist-17.c |   50 ++++++++++++++++++++++++++++++
>  gcc/tree-data-ref.c                      |    5 ++-
>  2 files changed, 53 insertions(+), 2 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ldist-17.c
>
> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-17.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-17.c
> new file mode 100644
> index 0000000..a831d3c
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-17.c
> @@ -0,0 +1,50 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -ftree-loop-distribution -fdump-tree-ldist-details" } */
> +
> +typedef int mad_fixed_t;
> +struct mad_pcm
> +{
> +  unsigned int samplerate;
> +  unsigned short channels;
> +  unsigned short length;
> +  mad_fixed_t samples[2][1152];
> +};
> +struct mad_synth
> +{
> +  mad_fixed_t filter[2][2][2][16][8];
> +  unsigned int phase;
> +  struct mad_pcm pcm;
> +};
> +void mad_synth_mute (struct mad_synth *synth);
> +void
> +mad_synth_mute (struct mad_synth *synth)
> +{
> +  unsigned int ch;
> +  unsigned int s;
> +  unsigned int v;
> +
> +  ch = 0U;
> +  while (ch < 2U)
> +    {
> +      s = 0U;
> +      while (s < 16U)
> +       {
> +         v = 0U;
> +         while (v < 8U)
> +           {
> +             synth->filter[ch][1][1][s][v] = 0;
> +             synth->filter[ch][1][0][s][v] = 0;
> +             synth->filter[ch][0][1][s][v] = 0;
> +             synth->filter[ch][0][0][s][v] = 0;
> +             v++;
> +           }
> +         s++;
> +       }
> +      ch++;
> +    }
> +  return;
> +}
> +
> +/* { dg-final { scan-tree-dump "distributed: split to 4" "ldist" } } */
> +/* { dg-final { scan-tree-dump-times "__builtin_memset" 8 "ldist" } } */
> +/* { dg-final { cleanup-tree-dump "ldist" } } */
> diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
> index 9a81370..a6d0731 100644
> --- a/gcc/tree-data-ref.c
> +++ b/gcc/tree-data-ref.c
> @@ -2653,7 +2653,8 @@ analyze_overlapping_iterations (tree chrec_a,
>   /* If they are the same chrec, and are affine, they overlap
>      on every iteration.  */
>   else if (eq_evolutions_p (chrec_a, chrec_b)
> -          && evolution_function_is_affine_multivariate_p (chrec_a, lnn))
> +          && (evolution_function_is_affine_multivariate_p (chrec_a, lnn)
> +              || operand_equal_p (chrec_a, chrec_b, 0)))
>     {
>       dependence_stats.num_same_subscript_function++;
>       *overlap_iterations_a = conflict_fn (1, affine_fn_cst (integer_zero_node));
> @@ -2662,7 +2663,7 @@ analyze_overlapping_iterations (tree chrec_a,
>     }
>
>   /* If they aren't the same, and aren't affine, we can't do anything
> -     yet. */
> +     yet.  */
>   else if ((chrec_contains_symbols (chrec_a)
>            || chrec_contains_symbols (chrec_b))
>           && (!evolution_function_is_affine_multivariate_p (chrec_a, lnn)
> --
> 1.7.1
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-15  2:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-13 19:27 [PATCH] Fix PR46928: handle "A[p] == A[p]" in data dep analysis with p a parameter of the loop Sebastian Pop
2010-12-15  2:28 ` 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).