Patchwork Fix PR46845: handle scop parameters before scev analysis.

login
register
mail settings
Submitter Sebastian Pop
Date Dec. 14, 2010, 7:24 a.m.
Message ID <1292311488-31351-1-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/75471/
State New
Headers show

Comments

Sebastian Pop - Dec. 14, 2010, 7:24 a.m.
Hi,

With this patch, we now handle scop parameters before triggering the
scev analysis.  I am currently testing this patch on amd64-linux.  Ok
for trunk after it passes regtest?

Thanks,
Sebastian

2010-12-14  Sebastian Pop  <sebastian.pop@amd.com>

	PR tree-optimization/46845
	* sese.c (scalar_evolution_in_region): Handle scop parameters
	before scev analysis.

	* gcc.dg/graphite/id-pr46845.c: New.
---
 gcc/ChangeLog                              |    6 ++++++
 gcc/sese.c                                 |    8 +++++---
 gcc/testsuite/ChangeLog                    |    5 +++++
 gcc/testsuite/gcc.dg/graphite/id-pr46845.c |   17 +++++++++++++++++
 4 files changed, 33 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/graphite/id-pr46845.c
Sebastian Pop - Dec. 14, 2010, 3:21 p.m.
On Tue, Dec 14, 2010 at 01:24, Sebastian Pop <sebpop@gmail.com> wrote:
> Hi,
>
> With this patch, we now handle scop parameters before triggering the
> scev analysis.  I am currently testing this patch on amd64-linux.  Ok
> for trunk after it passes regtest?
>

This patch passed regstrap on amd64-linux.

> Thanks,
> Sebastian
>
> 2010-12-14  Sebastian Pop  <sebastian.pop@amd.com>
>
>        PR tree-optimization/46845
>        * sese.c (scalar_evolution_in_region): Handle scop parameters
>        before scev analysis.
>
>        * gcc.dg/graphite/id-pr46845.c: New.
> ---
>  gcc/ChangeLog                              |    6 ++++++
>  gcc/sese.c                                 |    8 +++++---
>  gcc/testsuite/ChangeLog                    |    5 +++++
>  gcc/testsuite/gcc.dg/graphite/id-pr46845.c |   17 +++++++++++++++++
>  4 files changed, 33 insertions(+), 3 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.dg/graphite/id-pr46845.c
>
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index 0389806..b906953 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,3 +1,9 @@
> +2010-12-14  Sebastian Pop  <sebastian.pop@amd.com>
> +
> +       PR tree-optimization/46845
> +       * sese.c (scalar_evolution_in_region): Handle scop parameters
> +       before scev analysis.
> +
>  2010-12-10  Sebastian Pop  <sebastian.pop@amd.com>
>
>        PR tree-optimization/43023
> diff --git a/gcc/sese.c b/gcc/sese.c
> index 3bf6bea..076f07a 100644
> --- a/gcc/sese.c
> +++ b/gcc/sese.c
> @@ -801,14 +801,16 @@ scalar_evolution_in_region (sese region, loop_p loop, tree t)
>   struct loop *def_loop;
>   basic_block before = block_before_sese (region);
>
> +  /* SCOP parameters.  */
> +  if (TREE_CODE (t) == SSA_NAME
> +      && !defined_in_sese_p (t, region))
> +    return t;
> +
>   if (TREE_CODE (t) != SSA_NAME
>       || loop_in_sese_p (loop, region))
>     return instantiate_scev (before, loop,
>                             analyze_scalar_evolution (loop, t));
>
> -  if (!defined_in_sese_p (t, region))
> -    return t;
> -
>   def = SSA_NAME_DEF_STMT (t);
>   def_loop = loop_containing_stmt (def);
>
> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
> index 7bb46f3..48a26ba 100644
> --- a/gcc/testsuite/ChangeLog
> +++ b/gcc/testsuite/ChangeLog
> @@ -1,3 +1,8 @@
> +2010-12-14  Sebastian Pop  <sebastian.pop@amd.com>
> +
> +       PR tree-optimization/46845
> +       * gcc.dg/graphite/id-pr46845.c: New.
> +
>  2010-12-10  Sebastian Pop  <sebastian.pop@amd.com>
>
>        PR tree-optimization/43023
> diff --git a/gcc/testsuite/gcc.dg/graphite/id-pr46845.c b/gcc/testsuite/gcc.dg/graphite/id-pr46845.c
> new file mode 100644
> index 0000000..f4da78e
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/graphite/id-pr46845.c
> @@ -0,0 +1,17 @@
> +/* { dg-options "-O2 -ffast-math -fgraphite-identity -w -Wno-psabi" { target { i?86-*-* x86_64-*-* } } } */
> +
> +typedef float V2SF __attribute__ ((vector_size (128)));
> +
> +V2SF
> +foo (int x, V2SF a)
> +{
> +  V2SF b;
> +  if (x & 42)
> +    b = a;
> +  else
> +    b = a + (V2SF) {1.0f/0.0f - 1.0f/0.0f, 1.0f/0.0f - 1.0f/0.0f};
> +  while (x--)
> +    a += b;
> +
> +  return a;
> +}
> --
> 1.7.1
>
>
Richard Guenther - Dec. 15, 2010, 2:30 a.m.
On Tue, Dec 14, 2010 at 8:24 AM, Sebastian Pop <sebpop@gmail.com> wrote:
> Hi,
>
> With this patch, we now handle scop parameters before triggering the
> scev analysis.  I am currently testing this patch on amd64-linux.  Ok
> for trunk after it passes regtest?

Ok.

Thanks,
Richard.

> Thanks,
> Sebastian
>
> 2010-12-14  Sebastian Pop  <sebastian.pop@amd.com>
>
>        PR tree-optimization/46845
>        * sese.c (scalar_evolution_in_region): Handle scop parameters
>        before scev analysis.
>
>        * gcc.dg/graphite/id-pr46845.c: New.
> ---
>  gcc/ChangeLog                              |    6 ++++++
>  gcc/sese.c                                 |    8 +++++---
>  gcc/testsuite/ChangeLog                    |    5 +++++
>  gcc/testsuite/gcc.dg/graphite/id-pr46845.c |   17 +++++++++++++++++
>  4 files changed, 33 insertions(+), 3 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.dg/graphite/id-pr46845.c
>
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index 0389806..b906953 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,3 +1,9 @@
> +2010-12-14  Sebastian Pop  <sebastian.pop@amd.com>
> +
> +       PR tree-optimization/46845
> +       * sese.c (scalar_evolution_in_region): Handle scop parameters
> +       before scev analysis.
> +
>  2010-12-10  Sebastian Pop  <sebastian.pop@amd.com>
>
>        PR tree-optimization/43023
> diff --git a/gcc/sese.c b/gcc/sese.c
> index 3bf6bea..076f07a 100644
> --- a/gcc/sese.c
> +++ b/gcc/sese.c
> @@ -801,14 +801,16 @@ scalar_evolution_in_region (sese region, loop_p loop, tree t)
>   struct loop *def_loop;
>   basic_block before = block_before_sese (region);
>
> +  /* SCOP parameters.  */
> +  if (TREE_CODE (t) == SSA_NAME
> +      && !defined_in_sese_p (t, region))
> +    return t;
> +
>   if (TREE_CODE (t) != SSA_NAME
>       || loop_in_sese_p (loop, region))
>     return instantiate_scev (before, loop,
>                             analyze_scalar_evolution (loop, t));
>
> -  if (!defined_in_sese_p (t, region))
> -    return t;
> -
>   def = SSA_NAME_DEF_STMT (t);
>   def_loop = loop_containing_stmt (def);
>
> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
> index 7bb46f3..48a26ba 100644
> --- a/gcc/testsuite/ChangeLog
> +++ b/gcc/testsuite/ChangeLog
> @@ -1,3 +1,8 @@
> +2010-12-14  Sebastian Pop  <sebastian.pop@amd.com>
> +
> +       PR tree-optimization/46845
> +       * gcc.dg/graphite/id-pr46845.c: New.
> +
>  2010-12-10  Sebastian Pop  <sebastian.pop@amd.com>
>
>        PR tree-optimization/43023
> diff --git a/gcc/testsuite/gcc.dg/graphite/id-pr46845.c b/gcc/testsuite/gcc.dg/graphite/id-pr46845.c
> new file mode 100644
> index 0000000..f4da78e
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/graphite/id-pr46845.c
> @@ -0,0 +1,17 @@
> +/* { dg-options "-O2 -ffast-math -fgraphite-identity -w -Wno-psabi" { target { i?86-*-* x86_64-*-* } } } */
> +
> +typedef float V2SF __attribute__ ((vector_size (128)));
> +
> +V2SF
> +foo (int x, V2SF a)
> +{
> +  V2SF b;
> +  if (x & 42)
> +    b = a;
> +  else
> +    b = a + (V2SF) {1.0f/0.0f - 1.0f/0.0f, 1.0f/0.0f - 1.0f/0.0f};
> +  while (x--)
> +    a += b;
> +
> +  return a;
> +}
> --
> 1.7.1
>
>

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0389806..b906953 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@ 
+2010-12-14  Sebastian Pop  <sebastian.pop@amd.com>
+
+	PR tree-optimization/46845
+	* sese.c (scalar_evolution_in_region): Handle scop parameters
+	before scev analysis.
+
 2010-12-10  Sebastian Pop  <sebastian.pop@amd.com>
 
 	PR tree-optimization/43023
diff --git a/gcc/sese.c b/gcc/sese.c
index 3bf6bea..076f07a 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -801,14 +801,16 @@  scalar_evolution_in_region (sese region, loop_p loop, tree t)
   struct loop *def_loop;
   basic_block before = block_before_sese (region);
 
+  /* SCOP parameters.  */
+  if (TREE_CODE (t) == SSA_NAME
+      && !defined_in_sese_p (t, region))
+    return t;
+
   if (TREE_CODE (t) != SSA_NAME
       || loop_in_sese_p (loop, region))
     return instantiate_scev (before, loop,
 			     analyze_scalar_evolution (loop, t));
 
-  if (!defined_in_sese_p (t, region))
-    return t;
-
   def = SSA_NAME_DEF_STMT (t);
   def_loop = loop_containing_stmt (def);
 
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7bb46f3..48a26ba 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@ 
+2010-12-14  Sebastian Pop  <sebastian.pop@amd.com>
+
+	PR tree-optimization/46845
+	* gcc.dg/graphite/id-pr46845.c: New.
+
 2010-12-10  Sebastian Pop  <sebastian.pop@amd.com>
 
 	PR tree-optimization/43023
diff --git a/gcc/testsuite/gcc.dg/graphite/id-pr46845.c b/gcc/testsuite/gcc.dg/graphite/id-pr46845.c
new file mode 100644
index 0000000..f4da78e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-pr46845.c
@@ -0,0 +1,17 @@ 
+/* { dg-options "-O2 -ffast-math -fgraphite-identity -w -Wno-psabi" { target { i?86-*-* x86_64-*-* } } } */
+
+typedef float V2SF __attribute__ ((vector_size (128)));
+
+V2SF
+foo (int x, V2SF a)
+{
+  V2SF b;
+  if (x & 42)
+    b = a;
+  else
+    b = a + (V2SF) {1.0f/0.0f - 1.0f/0.0f, 1.0f/0.0f - 1.0f/0.0f};
+  while (x--)
+    a += b;
+
+  return a;
+}