public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR68961
@ 2016-01-15 11:44 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2016-01-15 11:44 UTC (permalink / raw)
  To: gcc-patches


Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2016-01-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/68961
	* tree-vect-slp.c (vect_analyze_slp_cost_1): Consider cost
	of invariants in stores again.

	* gcc.dg/vect/costmodel/x86_64/costmodel-pr68961.c: New testcase.

Index: gcc/tree-vect-slp.c
===================================================================
--- gcc/tree-vect-slp.c	(revision 232401)
+++ gcc/tree-vect-slp.c	(working copy)
@@ -1453,18 +1453,20 @@ vect_analyze_slp_cost_1 (slp_instance in
 	  /* Record the cost for the vector loads.  */
 	  vect_model_load_cost (stmt_info, ncopies_for_cost, false,
 				node, prologue_cost_vec, body_cost_vec);
+	  return;
 	}
-      return;
     }
-
-  record_stmt_cost (body_cost_vec, ncopies_for_cost, vector_stmt,
-		    stmt_info, 0, vect_body);
-  if (SLP_TREE_TWO_OPERATORS (node))
+  else
     {
       record_stmt_cost (body_cost_vec, ncopies_for_cost, vector_stmt,
 			stmt_info, 0, vect_body);
-      record_stmt_cost (body_cost_vec, ncopies_for_cost, vec_perm,
-			stmt_info, 0, vect_body);
+      if (SLP_TREE_TWO_OPERATORS (node))
+	{
+	  record_stmt_cost (body_cost_vec, ncopies_for_cost, vector_stmt,
+			    stmt_info, 0, vect_body);
+	  record_stmt_cost (body_cost_vec, ncopies_for_cost, vec_perm,
+			    stmt_info, 0, vect_body);
+	}
     }
 
   /* Push SLP node def-type to stmts.  */
Index: gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-pr68961.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-pr68961.c	(revision 0)
+++ gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-pr68961.c	(working copy)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-slp-details" } */
+
+struct x { double d[2]; };
+
+struct x
+pack (double a, double aa)
+{
+  struct x u;
+  u.d[0] = a;
+  u.d[1] = aa;
+  return u;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorization is not profitable" 1 "slp2" } } */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-15 11:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-15 11:44 [PATCH] Fix PR68961 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).