re PR tree-optimization/78997 (ICE on valid code at -O3 on x86_64-linux-gnu: verify_g...
authorRichard Biener <rguenther@suse.de>
Mon, 9 Jan 2017 08:25:13 +0000 (08:25 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 9 Jan 2017 08:25:13 +0000 (08:25 +0000)
2017-01-09  Richard Biener  <rguenther@suse.de>

PR tree-optimization/78997
* tree-vect-slp.c (vect_mask_constant_operand_p): Handle SSA
name condition properly.

* gcc.dg/torture/pr78997.c: New testcase.

From-SVN: r244218

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

index 40ecb03d0dd386a227a07523055e18e10274e773..96f3c2e615d272e569d74d65bdda5aabb07efc47 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-09  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/78997
+       * tree-vect-slp.c (vect_mask_constant_operand_p): Handle SSA
+       name condition properly.
+
 2017-01-09  Richard Biener  <rguenther@suse.de>
 
        PR debug/79000
index 51f3bf339595b5acc1bfceaa9acafdc481bd5f8c..053d2cf76f18c2e579fb8d55bb2f2d0e62f737cd 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-09  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/78997
+       * gcc.dg/torture/pr78997.c: New testcase.
+
 2017-01-09  Richard Biener  <rguenther@suse.de>
 
        PR debug/79000
diff --git a/gcc/testsuite/gcc.dg/torture/pr78997.c b/gcc/testsuite/gcc.dg/torture/pr78997.c
new file mode 100644 (file)
index 0000000..d43b973
--- /dev/null
@@ -0,0 +1,106 @@
+/* { dg-do compile } */
+
+int printf (const char *, ...);
+
+static short f, p, q, s, u, aa, ab, ac;
+static int b, c, d, e, h, k, l, m, n, o, r, t, v, w, x, y, z, ad, ae, af, ag, ah, ai, aj, ak, al, am, an;
+int a, ao, ap, aq, ar, g, as, at, au, av, aw, ax, ay;
+
+void foo ()
+{ 
+  int ba[2], i, j, bb;
+  while (b)
+    { 
+      b++;
+      while (b)
+       { 
+         for (; aw; aw++)
+           for (; q; q++)
+             { 
+               short bc[20];
+               if (k)
+                 for (i = 0; i < 4; i++)
+                   for (j = 0; j < 4; j++)
+                     if (p)
+                       bc[i * 4 + j] = 8;
+               for (; ad; ad--)
+                 t = bc[1];
+             }
+         for (bb = 0; bb < 5; bb++)
+           if (m && v)
+             { 
+               printf ("%d", n);
+               v = g && v;
+               n = 0;
+             }
+         ab &= ba[0];
+         aw = l;
+         aa++;
+         x++;
+         while (1)
+           { 
+             int bd[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1};
+             ap = a ? ba[1] : 0;
+             if (ba[0] && o < ax)
+               { 
+                 int be[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1};
+                 for (; ae; ae++)
+                   { 
+                     e ^= ba[b] ^ aa;
+                     f = r;
+                     for (; y; y++)
+                       aj &= u | ag;
+                     int e[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1};
+                     if (a)
+                       { 
+                         r = c;
+                         aj &= ag |= aq;
+                       }
+                     av = ai * u;
+                     af = c;
+                   }
+                 au = d;
+                 p++;
+                 u = aj;
+                 a = ba[1];
+                 at = ar = af != ai && l;
+                 as = ax = f;
+                 ao = ak ? 0 : ah;
+                 aw = ao;
+               }
+             ay = c;
+             int bf[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1};
+             if (w < f)
+               { 
+                 int bg[] = {0};
+                 if (aw)
+                   break;
+               }
+             else
+               aw = aa | (h &= ag) >> d, c = b = z && am;
+             for (; w; w--)
+               l = ac ^= al |= b;
+             for (; k; k = 0)
+               { 
+                 int bh = m | s && n;
+                 m = bh;
+                 for (; t; t--)
+                   f = q ^= (c < (e < ah));
+               }
+             d = an |= b;
+             if (v)
+               { 
+                 int bi[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1};
+                 if (aw)
+                   break;
+               }
+           }
+       }
+    }
+}
+
+int main ()
+{ 
+  foo ();
+  return 0;
+}
index 519652c2a23ed144cfeeded5f11faae5c5746801..f192c7d0ce87cb9213e2691f04d419f7471ac55c 100644 (file)
@@ -2897,9 +2897,8 @@ vect_mask_constant_operand_p (gimple *stmt, int opnum)
       tree cond = gimple_assign_rhs1 (stmt);
 
       if (TREE_CODE (cond) == SSA_NAME)
-       return false;
-
-      if (opnum)
+       op = cond;
+      else if (opnum)
        op = TREE_OPERAND (cond, 1);
       else
        op = TREE_OPERAND (cond, 0);