public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PING  Re:[PATCH] PR 71667 - Handle live operations with DEBUG uses
@ 2016-07-07 14:35 Alan Hayward
  2016-07-08  8:20 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Hayward @ 2016-07-07 14:35 UTC (permalink / raw)
  To: gcc-patches

Ping.


From: Alan Hayward <alan dot hayward at arm dot com>
To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot
org>
Date: Wed, 29 Jun 2016 08:49:34 +0100
Subject: [PATCH] PR 71667 - Handle live operations with DEBUG uses
Authentication-results: sourceware.org; auth=none

In vectorizable_live_operation() we always assume uses a of live operation
will be PHIs. However, when using -g a use of a live operation might be a
DEBUG stmt.

This patch avoids adding any DEBUG statments to the worklist in
vectorizable_live_operation(). Also fixes comment.

Tested on x86 and aarch64.
Ok to commit?

gcc/
    PR tree-optimization/71667
    * tree-vect-loop.c (vectorizable_live_operation): ignore DEBUG stmts

testsuite/gcc.dg/vect
    PR tree-optimization/71667
    * pr71667.c: New



diff --git a/gcc/testsuite/gcc.dg/vect/pr71667.c
b/gcc/testsuite/gcc.dg/vect/pr71667.c
new file mode 100644
index 
0000000000000000000000000000000000000000..e7012efa882a5497b0a6099c3d853f9eb
375cc53
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr71667.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-g" } */
+
+unsigned int mu;
+int pt;
+
+void
+qf (void)
+{
+  int gy;
+  long int vz;
+
+  for (;;)
+    {
+      for (gy = 0; gy < 80; ++gy)
+      {
+	vz = mu;
+	++mu;
+	pt = (vz != 0) && (pt != 0);
+      }
+      while (gy < 81)
+	while (gy < 83)
+	  {
+	    vz = (vz != 0) ? 0 : mu;
+	    ++gy;
+	  }
+      pt = vz;
+      ++mu;
+    }
+}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 
6c0337bbbcbebd6443fd3bcef45c1b23a7833486..2980a1b031cd3b919369b5e31dff7e066
5bc7578 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -6352,11 +6352,12 @@ vectorizable_live_operation (gimple *stmt,
 	: gimple_get_lhs (stmt);
   lhs_type = TREE_TYPE (lhs);

-  /* Find all uses of STMT outside the loop - there should be exactly
one.  */
+  /* Find all uses of STMT outside the loop - there should be at least
one.  */
   auto_vec<gimple *, 4> worklist;
   FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, lhs)
-    if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt)))
-	worklist.safe_push (use_stmt);
+    if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))
+	&& !is_gimple_debug (use_stmt))
+      worklist.safe_push (use_stmt);
   gcc_assert (worklist.length () >= 1);

   bitsize = TYPE_SIZE (TREE_TYPE (vectype));


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

* Re: PING Re:[PATCH] PR 71667 - Handle live operations with DEBUG uses
  2016-07-07 14:35 PING Re:[PATCH] PR 71667 - Handle live operations with DEBUG uses Alan Hayward
@ 2016-07-08  8:20 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-07-08  8:20 UTC (permalink / raw)
  To: Alan Hayward; +Cc: gcc-patches

On Thu, Jul 7, 2016 at 4:35 PM, Alan Hayward <alan.hayward@arm.com> wrote:
> Ping.

Ok.

Richard.

>
> From: Alan Hayward <alan dot hayward at arm dot com>
> To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot
> org>
> Date: Wed, 29 Jun 2016 08:49:34 +0100
> Subject: [PATCH] PR 71667 - Handle live operations with DEBUG uses
> Authentication-results: sourceware.org; auth=none
>
> In vectorizable_live_operation() we always assume uses a of live operation
> will be PHIs. However, when using -g a use of a live operation might be a
> DEBUG stmt.
>
> This patch avoids adding any DEBUG statments to the worklist in
> vectorizable_live_operation(). Also fixes comment.
>
> Tested on x86 and aarch64.
> Ok to commit?
>
> gcc/
>     PR tree-optimization/71667
>     * tree-vect-loop.c (vectorizable_live_operation): ignore DEBUG stmts
>
> testsuite/gcc.dg/vect
>     PR tree-optimization/71667
>     * pr71667.c: New
>
>
>
> diff --git a/gcc/testsuite/gcc.dg/vect/pr71667.c
> b/gcc/testsuite/gcc.dg/vect/pr71667.c
> new file mode 100644
> index
> 0000000000000000000000000000000000000000..e7012efa882a5497b0a6099c3d853f9eb
> 375cc53
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/vect/pr71667.c
> @@ -0,0 +1,30 @@
> +/* { dg-do compile } */
> +/* { dg-additional-options "-g" } */
> +
> +unsigned int mu;
> +int pt;
> +
> +void
> +qf (void)
> +{
> +  int gy;
> +  long int vz;
> +
> +  for (;;)
> +    {
> +      for (gy = 0; gy < 80; ++gy)
> +      {
> +       vz = mu;
> +       ++mu;
> +       pt = (vz != 0) && (pt != 0);
> +      }
> +      while (gy < 81)
> +       while (gy < 83)
> +         {
> +           vz = (vz != 0) ? 0 : mu;
> +           ++gy;
> +         }
> +      pt = vz;
> +      ++mu;
> +    }
> +}
> diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
> index
> 6c0337bbbcbebd6443fd3bcef45c1b23a7833486..2980a1b031cd3b919369b5e31dff7e066
> 5bc7578 100644
> --- a/gcc/tree-vect-loop.c
> +++ b/gcc/tree-vect-loop.c
> @@ -6352,11 +6352,12 @@ vectorizable_live_operation (gimple *stmt,
>         : gimple_get_lhs (stmt);
>    lhs_type = TREE_TYPE (lhs);
>
> -  /* Find all uses of STMT outside the loop - there should be exactly
> one.  */
> +  /* Find all uses of STMT outside the loop - there should be at least
> one.  */
>    auto_vec<gimple *, 4> worklist;
>    FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, lhs)
> -    if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt)))
> -       worklist.safe_push (use_stmt);
> +    if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))
> +       && !is_gimple_debug (use_stmt))
> +      worklist.safe_push (use_stmt);
>    gcc_assert (worklist.length () >= 1);
>
>    bitsize = TYPE_SIZE (TREE_TYPE (vectype));
>
>

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

end of thread, other threads:[~2016-07-08  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-07 14:35 PING Re:[PATCH] PR 71667 - Handle live operations with DEBUG uses Alan Hayward
2016-07-08  8:20 ` Richard Biener

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).