re PR tree-optimization/88069 (ICE in check_loop_closed_ssa_def, at tree-ssa-loop...
authorRichard Biener <rguenther@suse.de>
Tue, 20 Nov 2018 10:27:57 +0000 (10:27 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 20 Nov 2018 10:27:57 +0000 (10:27 +0000)
2018-11-20  Richard Biener  <rguenther@suse.de>

PR tree-optimization/88069
* tree-ssa-sccvn.c (visit_phi): Do not value-number to unvisited
virtual PHI arguments.

* gcc.dg/pr88069.c: New testcase.

From-SVN: r266308

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr88069.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.c

index 7589326..9cf7bb1 100644 (file)
@@ -1,3 +1,9 @@
+2018-11-20  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/88069
+       * tree-ssa-sccvn.c (visit_phi): Do not value-number to unvisited
+       virtual PHI arguments.
+
 2018-11-20  Ilya Leoshkevich  <iii@linux.ibm.com>
 
        PR target/88083
index 17cb438..099d464 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-20  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/88069
+       * gcc.dg/pr88069.c: New testcase.
+
 2018-11-20  Martin Liska  <mliska@suse.cz>
 
        PR ipa/88093
diff --git a/gcc/testsuite/gcc.dg/pr88069.c b/gcc/testsuite/gcc.dg/pr88069.c
new file mode 100644 (file)
index 0000000..2148513
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-pre -ftree-vectorize -fno-tree-pta" } */
+
+void
+qf (void);
+
+void
+mr (short int db)
+{
+  int vq;
+  short int *lp = &db;
+
+  for (vq = 0; vq < 1; ++vq)
+    qf ();
+
+  while (*lp < 2)
+    {
+      *lp = db;
+      lp = (short int *) &vq;
+      ++*lp;
+    }
+}
+
index 01bedf5..941752e 100644 (file)
@@ -4194,12 +4194,19 @@ visit_phi (gimple *phi, bool *inserted, bool backedges_varying_p)
      value from the backedge as that confuses the alias-walking code.
      See gcc.dg/torture/pr87176.c.  If the value is the same on a
      non-backedge everything is OK though.  */
-  if (backedge_val
-      && !seen_non_backedge
-      && TREE_CODE (backedge_val) == SSA_NAME
-      && sameval == backedge_val
-      && (SSA_NAME_IS_VIRTUAL_OPERAND (backedge_val)
-         || SSA_VAL (backedge_val) != backedge_val))
+  bool visited_p;
+  if ((backedge_val
+       && !seen_non_backedge
+       && TREE_CODE (backedge_val) == SSA_NAME
+       && sameval == backedge_val
+       && (SSA_NAME_IS_VIRTUAL_OPERAND (backedge_val)
+          || SSA_VAL (backedge_val) != backedge_val))
+      /* Do not value-number a virtual operand to sth not visited though
+        given that allows us to escape a region in alias walking.  */
+      || (sameval
+         && TREE_CODE (sameval) == SSA_NAME
+         && SSA_NAME_IS_VIRTUAL_OPERAND (sameval)
+         && (SSA_VAL (sameval, &visited_p), !visited_p)))
     /* Note this just drops to VARYING without inserting the PHI into
        the hashes.  */
     result = PHI_RESULT (phi);