re PR tree-optimization/91162 (ICE: tree check: expected class 'type', have 'exceptio...
authorRichard Biener <rguenther@suse.de>
Mon, 15 Jul 2019 12:48:47 +0000 (12:48 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 15 Jul 2019 12:48:47 +0000 (12:48 +0000)
2019-07-15  Richard Biener  <rguenther@suse.de>

PR middle-end/91162
* tree-cfg.c (move_block_to_fn): When releasing a virtual PHI
node make sure to replace all uses with something valid.

* gcc.dg/autopar/pr91162.c: New testcase.

From-SVN: r273492

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/autopar/pr91162.c [new file with mode: 0644]
gcc/tree-cfg.c

index 1ff1c4c7fcdd73980b047029770613d68a01456c..af0b4b5e165c54dfda66a6f63d2d5a72fb5c284f 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-15  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/91162
+       * tree-cfg.c (move_block_to_fn): When releasing a virtual PHI
+       node make sure to replace all uses with something valid.
+
 2019-07-15  Kewen Lin  <linkw@gcc.gnu.org>
 
        PR tree-optimization/88497
index 57d11413f5adb4804eecebec1980de0151d72c67..d36652f91e2e5574a43333ad1a7b59e798e8094f 100644 (file)
@@ -1,3 +1,8 @@
+2019-07-15  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/91162
+       * gcc.dg/autopar/pr91162.c: New testcase.
+
 2019-07-15  Kewen Lin  <linkw@gcc.gnu.org>
 
        PR tree-optimization/88497
diff --git a/gcc/testsuite/gcc.dg/autopar/pr91162.c b/gcc/testsuite/gcc.dg/autopar/pr91162.c
new file mode 100644 (file)
index 0000000..4bfedb9
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-parallelize-loops=2 -fno-tree-dominator-opts --param parloops-min-per-thread=30" } */
+
+void
+zf (__int128 ct)
+{
+  __int128 *rk = &ct;
+
+  if (0)
+    {
+      int jj;
+
+t9:
+      for (jj = 0; jj < 60; ++jj)
+       {
+       }
+
+      __builtin_unreachable ();
+    }
+
+  while (*rk < 1)
+    ++*rk;
+
+  goto t9;
+}
index 5c67d024608c1c45b945b1b47763a19bd39f59ad..4521fe347dc464472e7f70604ee1089b9455f0ed 100644 (file)
@@ -7088,7 +7088,14 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
       if (virtual_operand_p (op))
        {
          /* Remove the phi nodes for virtual operands (alias analysis will be
-            run for the new function, anyway).  */
+            run for the new function, anyway).  But replace all uses that
+            might be outside of the region we move.  */
+         use_operand_p use_p;
+         imm_use_iterator iter;
+         gimple *use_stmt;
+         FOR_EACH_IMM_USE_STMT (use_stmt, iter, op)
+           FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
+             SET_USE (use_p, SSA_NAME_VAR (op));
           remove_phi_node (&psi, true);
          continue;
        }