]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/91200 (ICE on valid code at -O1: verify_ssa failed)
authorRichard Biener <rguenther@suse.de>
Fri, 19 Jul 2019 12:24:53 +0000 (12:24 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 19 Jul 2019 12:24:53 +0000 (12:24 +0000)
2019-07-19  Richard Biener  <rguenther@suse.de>

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
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr91200.c [new file with mode: 0644]
gcc/tree-ssa-phiopt.c

index 34c6d31f3f9f2a16e5e777a8024fd77801ba9af8..96c0b96e1dfe12b0a9d604e63e0ad367c95e3587 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-19  Richard Biener  <rguenther@suse.de>
+
+       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  <richard.sandiford@arm.com>
 
        * doc/invoke.texi: Rename the AArch64 +bitperm extension flag
index 906ca0e5d305495ca69197f1281707ea21b52780..dfbf850b4fc1d5265aa0966fabb6f55e212c5bd6 100644 (file)
@@ -1,3 +1,8 @@
+2019-07-19  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/91200
+       * gcc.dg/torture/pr91200.c: New testcase.
+
 2019-07-19  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..09db9e1
--- /dev/null
@@ -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;
+}
index a514ed81ef9968ce71e8345231bc9c604a7cbff0..b64bde695f4299393594eda6d20b0b2849ca549b 100644 (file)
@@ -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);