This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, PR tree-optimization/71006] Fix vectype computation for COND_EXPR


Hi,

Currently we have a code in vect_determine_vectorization_factor to
compute vectype for mask producers.  It wasn't meant to be used for
EXPR_COND assignments but it is used now in some cases causing wrong
resulting vectype.

Bootstrapped and regtested for x86_64-pc-linux-gnu.  OK for trunk?

Thanks,
Ilya
--
gcc/

2016-05-12  Ilya Enkovich  <ilya.enkovich@intel.com>

	PR tree-optimization/71006
	* tree-vect-loop.c (vect_determine_vectorization_factor): Don't
	consider COND_EXPR as a mask producer.

gcc/testsuite/

2016-05-12  Ilya Enkovich  <ilya.enkovich@intel.com>

	PR tree-optimization/71006
	* gcc.dg/pr71006.c: New test.


diff --git a/gcc/testsuite/gcc.dg/pr71006.c b/gcc/testsuite/gcc.dg/pr71006.c
new file mode 100644
index 0000000..2b45aa0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr71006.c
@@ -0,0 +1,16 @@
+/* PR target/71006 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-vectorize" } */
+
+unsigned char uu, gu, e2;
+
+void
+fs (void)
+{
+  char *nq = (char *)&gu, *k4 = (char *)&gu;
+  while (*k4 < 1)
+    {
+      uu += (*nq != 0 || e2 != 0);
+      ++*k4;
+    }
+}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index da98211..d673c67 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -437,7 +437,9 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 	      /* Bool ops don't participate in vectorization factor
 		 computation.  For comparison use compared types to
 		 compute a factor.  */
-	      if (TREE_CODE (scalar_type) == BOOLEAN_TYPE)
+	      if (TREE_CODE (scalar_type) == BOOLEAN_TYPE
+		  && is_gimple_assign (stmt)
+		  && gimple_assign_rhs_code (stmt) != COND_EXPR)
 		{
 		  if (STMT_VINFO_RELEVANT_P (stmt_info))
 		    mask_producers.safe_push (stmt_info);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]