re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool...
authorRichard Biener <rguenther@suse.de>
Tue, 28 Aug 2018 10:13:18 +0000 (10:13 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 28 Aug 2018 10:13:18 +0000 (10:13 +0000)
2018-08-28  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87117
* tree-ssa-pre.c (compute_avail): Do not make expressions
with predicated values available.
(get_expr_value_id): Assert we do not run into predicated value
expressions.

* gcc.dg/pr87117-2.c: New testcase.

From-SVN: r263910

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr87117-2.c [new file with mode: 0644]
gcc/tree-ssa-pre.c

index b8c25ba6ea76a15357df703d97598a325400c8f4..dd3ca99c80efc395870a135a60a791a7fdc78a6f 100644 (file)
@@ -1,3 +1,11 @@
+2018-08-28  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87117
+       * tree-ssa-pre.c (compute_avail): Do not make expressions
+       with predicated values available.
+       (get_expr_value_id): Assert we do not run into predicated value
+       expressions.
+
 2018-08-28  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/87117
index ddd365ecadef3c22e1ef8163108e1b2e5b62dd77..aa6f7707333afbbc8b4652180f074eb37dd7fb7f 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-28  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87117
+       * gcc.dg/pr87117-2.c: New testcase.
+
 2018-08-28  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/87117
diff --git a/gcc/testsuite/gcc.dg/pr87117-2.c b/gcc/testsuite/gcc.dg/pr87117-2.c
new file mode 100644 (file)
index 0000000..aefa813
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fcode-hoisting" } */
+
+void e();
+
+void a(int c, char **d)
+{
+  char b;
+  if (1 < c)
+    b = (char)(__INTPTR_TYPE__)d[0];
+  if (1 < c && b)
+    e();
+  while (1 < c)
+    ;
+}
index 2dce88bd85e4d486d4f0dbb125d6a10e3cc7d050..267086cdf485786e15bc1bf18df4f4fb922e162f 100644 (file)
@@ -663,6 +663,7 @@ get_expr_value_id (pre_expr expr)
       id = VN_INFO (PRE_EXPR_NAME (expr))->value_id;
       break;
     case NARY:
+      gcc_assert (!PRE_EXPR_NARY (expr)->predicated_values);
       id = PRE_EXPR_NARY (expr)->value_id;
       break;
     case REFERENCE:
@@ -3902,7 +3903,7 @@ compute_avail (void)
                        continue;
 
                      vn_nary_op_lookup_stmt (stmt, &nary);
-                     if (!nary)
+                     if (!nary || nary->predicated_values)
                        continue;
 
                      /* If the NARY traps and there was a preceding