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

Richard.

2017-11-02  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/82795
        * tree-if-conv.c (predicate_mem_writes): Remove bogus assert.

        * gcc.target/i386/pr82795.c: New testcase.

Index: gcc/tree-if-conv.c
===================================================================
--- gcc/tree-if-conv.c  (revision 254211)
+++ gcc/tree-if-conv.c  (working copy)
@@ -2247,10 +2247,7 @@ predicate_mem_writes (loop_p loop)
                                         TREE_OPERAND (cond, 0),
                                         TREE_OPERAND (cond, 1));
                  else
-                   {
-                     gcc_assert (TREE_CODE (cond) == SSA_NAME);
-                     mask = cond;
-                   }
+                   mask = cond;
 
                  if (swap)
                    {
Index: gcc/testsuite/gcc.target/i386/pr82795.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr82795.c     (nonexistent)
+++ gcc/testsuite/gcc.target/i386/pr82795.c     (working copy)
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx2" } */
+
+void
+sj (int qh, int rn, int *by)
+{
+  for (;;)
+    if (qh != 0)
+      {
+       int dc;
+
+       for (dc = 0; dc < 17; ++dc)
+         {
+           int nn;
+
+           nn = (rn != 0) ? qh : dc;
+           if (nn != 0)
+             qh = nn;
+           else
+             qh = (qh != 0) ? *by : dc;
+         }
+      }
+}

Reply via email to