public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fixup PR78396 fix
Date: Thu, 24 Nov 2016 12:50:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.11.1611241347500.5294@t29.fhfr.qr> (raw)


I noticed a few failing SPEC benchs on a AVX2 machine which is because
when now doing BB vectorization on a failed-to-vectorize if-converted
loop body we can end up with unvectorized masked loads/stores.  As
BB vectorization does not handle masked loads/stores at all the following
patch simply avoids doing BB vectorization.

Bootstrap / regtest in progress.

I'll try to isolate a testcase later.

Richard.

2016-11-24  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/78396
	* tree-vectorizer.c (vectorize_loops): When the if-converted
	body contains masked loads or stores do not attempt to
	basic-block-vectorize it.

Index: gcc/tree-vectorizer.c
===================================================================
--- gcc/tree-vectorizer.c	(revision 242834)
+++ gcc/tree-vectorizer.c	(working copy)
@@ -570,14 +570,22 @@ vectorize_epilogue:
 		&& ! loop->inner)
 	      {
 		basic_block bb = loop->header;
+		bool has_mask_load_store = false;
 		for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
 		     !gsi_end_p (gsi); gsi_next (&gsi))
 		  {
 		    gimple *stmt = gsi_stmt (gsi);
+		    if (gimple_call_internal_p (stmt)
+			&& (gimple_call_internal_fn (stmt) == IFN_MASK_LOAD
+			    || gimple_call_internal_fn (stmt) == IFN_MASK_STORE))
+		      {
+			has_mask_load_store = true;
+			break;
+		      }
 		    gimple_set_uid (stmt, -1);
 		    gimple_set_visited (stmt, false);
 		  }
-		if (vect_slp_bb (bb))
+		if (! has_mask_load_store && vect_slp_bb (bb))
 		  {
 		    dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
 				     "basic block vectorized\n");

                 reply	other threads:[~2016-11-24 12:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=alpine.LSU.2.11.1611241347500.5294@t29.fhfr.qr \
    --to=rguenther@suse.de \
    --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).