From 7b1b0cc127d2f29f6ce8158e9e814b99cc5a9304 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 9 Jan 2017 08:25:13 +0000 Subject: [PATCH] re PR tree-optimization/78997 (ICE on valid code at -O3 on x86_64-linux-gnu: verify_gimple failed) 2017-01-09 Richard Biener 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 | 6 ++ gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/gcc.dg/torture/pr78997.c | 106 +++++++++++++++++++++++++ gcc/tree-vect-slp.c | 5 +- 4 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr78997.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 40ecb03d0dd..96f3c2e615d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-01-09 Richard Biener + + PR tree-optimization/78997 + * tree-vect-slp.c (vect_mask_constant_operand_p): Handle SSA + name condition properly. + 2017-01-09 Richard Biener PR debug/79000 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 51f3bf33959..053d2cf76f1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-09 Richard Biener + + PR tree-optimization/78997 + * gcc.dg/torture/pr78997.c: New testcase. + 2017-01-09 Richard Biener 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 index 00000000000..d43b97370ad --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr78997.c @@ -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; +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 519652c2a23..f192c7d0ce8 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -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); -- 2.30.2