re PR tree-optimization/68305 (ICE on valid code at -O3 on x86_64-linux-gnu: tree...
authorIlya Enkovich <enkovich.gnu@gmail.com>
Thu, 12 Nov 2015 12:59:05 +0000 (12:59 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Thu, 12 Nov 2015 12:59:05 +0000 (12:59 +0000)
gcc/

PR tree-optimization/68305
* tree-vect-slp.c (vect_get_constant_vectors): Support
COND_EXPR with SSA_NAME as a condition.

gcc/testsuite/

PR tree-optimization/68305
* gcc.dg/vect/pr68305.c: New test.

From-SVN: r230252

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr68305.c [new file with mode: 0644]
gcc/tree-vect-slp.c

index d43e6cf..b7c3df7 100644 (file)
@@ -1,3 +1,9 @@
+2015-11-12  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       PR tree-optimization/68305
+       * tree-vect-slp.c (vect_get_constant_vectors): Support
+       COND_EXPR with SSA_NAME as a condition.
+
 2015-11-12  Eric Botcazou  <ebotcazou@adacore.com>
 
        * config/visium/visium-protos.h (notice_update_cc): Delete.
index d3259b6..c71b979 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-12  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       PR tree-optimization/68305
+       * gcc.dg/vect/pr68305.c: New test.
+
 2015-11-12  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.target/i386/pr67265-2.c: New test.
diff --git a/gcc/testsuite/gcc.dg/vect/pr68305.c b/gcc/testsuite/gcc.dg/vect/pr68305.c
new file mode 100644 (file)
index 0000000..fde3db7
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+/* { dg-additional-options "-mavx2" { target avx_runtime } } */
+
+int a, b;
+
+void
+fn1 ()
+{
+  int c, d;
+  for (; b; b++)
+    a = a ^ !c ^ !d;
+}
index 75875f3..ab1d40e 100644 (file)
@@ -2740,18 +2740,20 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
              switch (code)
                {
                  case COND_EXPR:
-                   if (op_num == 0 || op_num == 1)
-                     {
-                       tree cond = gimple_assign_rhs1 (stmt);
+                   {
+                     tree cond = gimple_assign_rhs1 (stmt);
+                     if (TREE_CODE (cond) == SSA_NAME)
+                       op = gimple_op (stmt, op_num + 1);
+                     else if (op_num == 0 || op_num == 1)
                        op = TREE_OPERAND (cond, op_num);
-                     }
-                   else
-                     {
-                       if (op_num == 2)
-                         op = gimple_assign_rhs2 (stmt);
-                       else
-                         op = gimple_assign_rhs3 (stmt);
-                     }
+                     else
+                       {
+                         if (op_num == 2)
+                           op = gimple_assign_rhs2 (stmt);
+                         else
+                           op = gimple_assign_rhs3 (stmt);
+                       }
+                   }
                    break;
 
                  case CALL_EXPR: