From a263e61a36e21451ff46318f0430e57aeaef6583 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 19 Jul 2019 12:24:53 +0000 Subject: [PATCH] re PR tree-optimization/91200 (ICE on valid code at -O1: verify_ssa failed) 2019-07-19 Richard Biener PR tree-optimization/91200 * tree-ssa-phiopt.c (cond_store_replacement): Check we have no PHI nodes in middle-bb. * gcc.dg/torture/pr91200.c: New testcase. From-SVN: r273602 --- gcc/ChangeLog | 6 +++++ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.dg/torture/pr91200.c | 32 ++++++++++++++++++++++++++ gcc/tree-ssa-phiopt.c | 5 ++++ 4 files changed, 48 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr91200.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 34c6d31f3f9..96c0b96e1df 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-07-19 Richard Biener + + PR tree-optimization/91200 + * tree-ssa-phiopt.c (cond_store_replacement): Check we have + no PHI nodes in middle-bb. + 2019-07-19 Richard Sandiford * doc/invoke.texi: Rename the AArch64 +bitperm extension flag diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 906ca0e5d30..dfbf850b4fc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-07-19 Richard Biener + + PR tree-optimization/91200 + * gcc.dg/torture/pr91200.c: New testcase. + 2019-07-19 Jakub Jelinek PR middle-end/91190 diff --git a/gcc/testsuite/gcc.dg/torture/pr91200.c b/gcc/testsuite/gcc.dg/torture/pr91200.c new file mode 100644 index 00000000000..09db9e142c7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr91200.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ + +int printf (const char *, ...); + +char a; +int b, c, **d; + +int main () +{ + int f = -128, *g, *h[2] = {0, 0}, i; + printf("0"); + if (a) + { + while (f > a) { + int *j = &i; + *j |= 0; + } + h[i] = &c; + } + if (h[1]) + { + int **k = &g; + *k = &f; + while (i) + { + int **l[] = {&g}; + } + int **m = &g; + *d = *m = &b; + } + return 0; +} diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index a514ed81ef9..b64bde695f4 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -2216,6 +2216,11 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, || gimple_has_volatile_ops (assign)) return false; + /* And no PHI nodes so all uses in the single stmt are also + available where we insert to. */ + if (!gimple_seq_empty_p (phi_nodes (middle_bb))) + return false; + locus = gimple_location (assign); lhs = gimple_assign_lhs (assign); rhs = gimple_assign_rhs1 (assign); -- 2.30.2