public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH][3/3] No need to vectorize simple only-live stmts
@ 2016-06-02 16:14 Alan Hayward
  2016-06-03 11:03 ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Hayward @ 2016-06-02 16:14 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]


>Statements which are live but not relevant need marking to ensure they are
>vectorized.
>
>Live statements which are simple and all uses of them are invariant do not
>need
>to be vectorized.
>
>This patch adds a check to make sure those stmts which pass both the above
>checks are not vectorized and then discarded.
>
>Tested on x86 and aarch64.
>
>
>gcc/
>        *tree-vect-stmts.c (vect_stmt_relevant_p): Do not vectorize non
>live
>        relevant stmts which are simple and invariant.
>
>        testsuite/
>        * gcc.dg/vect/vect-live-slp-5.c: Remove dg check.


This version adds an addition relevance check in
vectorizable_live_operation.
It requires the "Remove duplicated GOMP SIMD LANE code” to work.

gcc/
	\* tree-vect-stmts.c (vect_stmt_relevant_p): Do not vectorize non live
	relevant stmts which are simple and invariant.
	\* tree-vect-loop.c (vectorizable_live_operation): Check relevance
	instead of simple and invariant

testsuite/
	\* gcc.dg/vect/vect-live-slp-5.c: Remove dg check.
    



Alan.


[-- Attachment #2: 3of3relevant.patch --]
[-- Type: application/octet-stream, Size: 2314 bytes --]

diff --git a/gcc/testsuite/gcc.dg/vect/vect-live-5.c b/gcc/testsuite/gcc.dg/vect/vect-live-5.c
index f475ca822b18874c5beca7465ae2094281644d96..188e4faf71334a6045296a7a98fa34274895955c 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-live-5.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-live-5.c
@@ -46,5 +46,4 @@ main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 1 "vect" } } */
-/* { dg-final { scan-tree-dump "statement is simple and uses invariant.  Leaving in place" "vect" } } */
+/* { dg-final { scan-tree-dump-not "vec_stmt_relevant_p: stmt live but not relevant" "vect" } } */
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index f72ac37ad29d00fba3af3c04f8048d8a943d10b8..08b1c0ebfdabf525a2fda8335a92285c0c79b970 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -6343,11 +6343,12 @@ vectorizable_live_operation (gimple *stmt,
   if (nested_in_vect_loop_p (loop, stmt))
     return false;
 
-  /* If STMT is a simple assignment and its inputs are invariant, then it can
-     remain in place, unvectorized.  The original last scalar value that it
-     computes will be used.  */
-  if (is_simple_and_all_uses_invariant (stmt, loop_vinfo))
+  /* If STMT is not relevant and it is a simple assignment and its inputs are
+     invariant then it can remain in place, unvectorized.  The original last
+     scalar value that it computes will be used.  */
+  if (!STMT_VINFO_RELEVANT_P (stmt_info))
     {
+      gcc_assert (is_simple_and_all_uses_invariant (stmt, loop_vinfo));
       if (dump_enabled_p ())
 	dump_printf_loc (MSG_NOTE, vect_location,
 			 "statement is simple and uses invariant.  Leaving in "
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index cd7a1719c43b4df0e48cdbaedc0fc04167567217..1ef924a4aa07aa626a603f5fb59bf991a89c1d9a 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -335,7 +335,8 @@ vect_stmt_relevant_p (gimple *stmt, loop_vec_info loop_vinfo,
 	}
     }
 
-  if (*live_p && *relevant == vect_unused_in_scope)
+  if (*live_p && *relevant == vect_unused_in_scope
+      && !is_simple_and_all_uses_invariant (stmt, loop_vinfo))
     {
       if (dump_enabled_p ())
 	dump_printf_loc (MSG_NOTE, vect_location,

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

* Re: [PATCH][3/3] No need to vectorize simple only-live stmts
  2016-06-02 16:14 [PATCH][3/3] No need to vectorize simple only-live stmts Alan Hayward
@ 2016-06-03 11:03 ` Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2016-06-03 11:03 UTC (permalink / raw)
  To: Alan Hayward; +Cc: gcc-patches

On Thu, Jun 2, 2016 at 6:14 PM, Alan Hayward <alan.hayward@arm.com> wrote:
>
>>Statements which are live but not relevant need marking to ensure they are
>>vectorized.
>>
>>Live statements which are simple and all uses of them are invariant do not
>>need
>>to be vectorized.
>>
>>This patch adds a check to make sure those stmts which pass both the above
>>checks are not vectorized and then discarded.
>>
>>Tested on x86 and aarch64.
>>
>>
>>gcc/
>>        *tree-vect-stmts.c (vect_stmt_relevant_p): Do not vectorize non
>>live
>>        relevant stmts which are simple and invariant.
>>
>>        testsuite/
>>        * gcc.dg/vect/vect-live-slp-5.c: Remove dg check.
>
>
> This version adds an addition relevance check in
> vectorizable_live_operation.
> It requires the "Remove duplicated GOMP SIMD LANE code” to work.
>
> gcc/
>         \* tree-vect-stmts.c (vect_stmt_relevant_p): Do not vectorize non live
>         relevant stmts which are simple and invariant.
>         \* tree-vect-loop.c (vectorizable_live_operation): Check relevance
>         instead of simple and invariant

Ok.

Richard.

> testsuite/
>         \* gcc.dg/vect/vect-live-slp-5.c: Remove dg check.
>
>
>
>
> Alan.
>

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

* [PATCH][3/3] No need to vectorize simple only-live stmts
@ 2016-05-27 11:41 Alan Hayward
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Hayward @ 2016-05-27 11:41 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 563 bytes --]

Statements which are live but not relevant need marking to ensure they are
vectorized.

Live statements which are simple and all uses of them are invariant do not
need
to be vectorized.

This patch adds a check to make sure those stmts which pass both the above
checks are not vectorized and then discarded.

Tested on x86 and aarch64.


gcc/
        *tree-vect-stmts.c (vect_stmt_relevant_p): Do not vectorize non
live
        relevant stmts which are simple and invariant.

        testsuite/
        * gcc.dg/vect/vect-live-slp-5.c: Remove dg check.



Alan.


[-- Attachment #2: live3.patch --]
[-- Type: application/octet-stream, Size: 1259 bytes --]

diff --git a/gcc/testsuite/gcc.dg/vect/vect-live-5.c b/gcc/testsuite/gcc.dg/vect/vect-live-5.c
index f475ca822b18874c5beca7465ae2094281644d96..56dc1fae02b55bd4f0426ee8dd38475c1c7d3161 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-live-5.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-live-5.c
@@ -46,5 +46,5 @@ main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-not "vec_stmt_relevant_p: stmt live but not relevant" "vect" } } */
 /* { dg-final { scan-tree-dump "statement is simple and uses invariant.  Leaving in place" "vect" } } */
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 76a4ffa41ad4c61c9307894cf34939967980d363..ae1542ede5891dac5b2ca39000fdc85bfe6c6dd5 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -335,7 +335,8 @@ vect_stmt_relevant_p (gimple *stmt, loop_vec_info loop_vinfo,
 	}
     }
 
-  if (*live_p && *relevant == vect_unused_in_scope)
+  if (*live_p && *relevant == vect_unused_in_scope
+      && !is_simple_and_all_uses_invariant (stmt, loop_vinfo))
     {
       if (dump_enabled_p ())
 	dump_printf_loc (MSG_NOTE, vect_location,

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

end of thread, other threads:[~2016-06-03 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-02 16:14 [PATCH][3/3] No need to vectorize simple only-live stmts Alan Hayward
2016-06-03 11:03 ` Richard Biener
  -- strict thread matches above, loose matches on Subject: below --
2016-05-27 11:41 Alan Hayward

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