public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alan Hayward <alan.hayward@arm.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][3/3] No need to vectorize simple only-live stmts
Date: Thu, 02 Jun 2016 16:14:00 -0000	[thread overview]
Message-ID: <D37619F4.F3F9%alan.hayward@arm.com> (raw)

[-- 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,

             reply	other threads:[~2016-06-02 16:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02 16:14 Alan Hayward [this message]
2016-06-03 11:03 ` Richard Biener
  -- strict thread matches above, loose matches on Subject: below --
2016-05-27 11:41 Alan Hayward

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D37619F4.F3F9%alan.hayward@arm.com \
    --to=alan.hayward@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).