re PR tree-optimization/77839 (Memory- and compile time hog at -O1 and above)
authorRichard Biener <rguenther@suse.de>
Thu, 6 Oct 2016 08:54:37 +0000 (08:54 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 6 Oct 2016 08:54:37 +0000 (08:54 +0000)
2016-10-06  Richard Biener  <rguenther@suse.de>

PR tree-optimization/77839
* tree-ssa-sccvn.c (set_ssa_val_to): Forbid value -> constant value
lattice transition.

* gcc.dg/torture/pr77839.c: New testcase.

From-SVN: r240829

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

index aa41f37050c192968d9f3f45b9fba27d16897d85..b7e7a6d0f59a56206700d0820894f77173025c34 100644 (file)
@@ -1,3 +1,9 @@
+2016-10-06  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/77839
+       * tree-ssa-sccvn.c (set_ssa_val_to): Forbid value -> constant value
+       lattice transition.
+
 2016-10-06  Martin Liska  <mliska@suse.cz>
 
        * gcc.c: Set -fprofile-update=atomic when profiling is
index 1f55a336708ff9e736d37e44cbd02b42eae3f08c..0f24a758cf2bd8cebc232cf5e5f7b86b91035184 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-06  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/77839
+       * gcc.dg/torture/pr77839.c: New testcase.
+
 2016-10-06  Marek Polacek  <polacek@redhat.com>
 
        * g++.dg/cpp1z/init-statement9.C: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pr77839.c b/gcc/testsuite/gcc.dg/torture/pr77839.c
new file mode 100644 (file)
index 0000000..b98231b
--- /dev/null
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+
+void
+sd(int yn)
+{
+  while (yn < 1)
+    {
+      int hy;
+      int *n6 = &hy;
+      int **ot = &n6;
+
+      (void)ot;
+      for (yn = 0; yn < 1; ++yn)
+       {
+         int tc, wo = 0, ez = 0, b8 = 0;
+         int *ls = &wo;
+
+         (void)ls;
+         hy = 0;
+         for (tc = 0; tc < 1; ++tc)
+           {
+             ez ^= hy;
+             wo ^= ez;
+             ++b8;
+           }
+         hy += (b8 < wo);
+       }
+    }
+}
index 1653d7393dcafed7391c234119c7484eb7a215ca..fc8bf74766b2e5e646acb439c5366675ceeb323c 100644 (file)
@@ -3260,6 +3260,23 @@ set_ssa_val_to (tree from, tree to)
            }
          return false;
        }
+      else if (currval != VN_TOP
+              && ! is_gimple_min_invariant (currval)
+              && is_gimple_min_invariant (to))
+       {
+         if (dump_file && (dump_flags & TDF_DETAILS))
+           {
+             fprintf (dump_file, "Forcing VARYING instead of changing "
+                      "value number of ");
+             print_generic_expr (dump_file, from, 0);
+             fprintf (dump_file, " from ");
+             print_generic_expr (dump_file, currval, 0);
+             fprintf (dump_file, " (non-constant) to ");
+             print_generic_expr (dump_file, to, 0);
+             fprintf (dump_file, " (constant)\n");
+           }
+         to = from;
+       }
       else if (TREE_CODE (to) == SSA_NAME
               && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (to))
        to = from;