re PR tree-optimization/87087 (Optimization hangs up and consumes over 15Gb of memory)
authorRichard Biener <rguenther@suse.de>
Thu, 18 Oct 2018 08:40:54 +0000 (08:40 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 18 Oct 2018 08:40:54 +0000 (08:40 +0000)
2018-10-18  Richard Biener  <rguenther@suse.de>

PR middle-end/87087
Revert
2018-02-07  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/84204
        * tree-chrec.c (chrec_fold_plus_1): Remove size limiting in
        this place.

* gcc.dg/torture/pr87087.c: New testcase.
* gcc.dg/graphite/pr84204.c: XFAIL.
* gcc.dg/graphite/pr85935.c: Likewise.

From-SVN: r265261

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/pr84204.c
gcc/testsuite/gcc.dg/graphite/pr85935.c
gcc/testsuite/gcc.dg/torture/pr87087.c [new file with mode: 0644]
gcc/tree-chrec.c

index 41a1dd13b6761b3831a4edbcbad9a76cbe58ab60..1177676472777f0117020bc302282b32ea08f4b4 100644 (file)
@@ -1,3 +1,13 @@
+2018-10-18  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/87087
+       Revert
+       2018-02-07  Richard Biener  <rguenther@suse.de>
+
+        PR tree-optimization/84204
+        * tree-chrec.c (chrec_fold_plus_1): Remove size limiting in
+        this place.
+
 2018-10-18  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/87537
index 5e1ad063d9b7ea56b3613b93ef2b5502fff94b93..9cf4cbc40195ef2fa9bd24ffd2f6fb2dbbd84e77 100644 (file)
@@ -1,3 +1,10 @@
+2018-10-18  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/87087
+       * gcc.dg/torture/pr87087.c: New testcase.
+       * gcc.dg/graphite/pr84204.c: XFAIL.
+       * gcc.dg/graphite/pr85935.c: Likewise.
+
 2018-10-18  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/87537
index 91401df609df55738acfc2e372fa7a8aff9b0392..9e2d39ed5cc67ae0db61738fa0181bca96775254 100644 (file)
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O -floop-parallelize-all -fno-tree-loop-im --param scev-max-expr-size=3" } */
+/* The fix for PR84204 was reverted.  */
+/* { dg-additional-options "--param graphite-allow-codegen-errors=1" } */
 
 int oc;
 
index 8c63ea93770cfdeb87fd53e7ffb8786ec26fab98..4c05f546dc4ef868dbeb85175cab59150a9d04c3 100644 (file)
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O -floop-parallelize-all -fno-tree-loop-im --param scev-max-expr-size=3" } */
+/* The fix for PR84204 was reverted.  */
+/* { dg-additional-options "--param graphite-allow-codegen-errors=1" } */
 
 typedef int dq;
 
diff --git a/gcc/testsuite/gcc.dg/torture/pr87087.c b/gcc/testsuite/gcc.dg/torture/pr87087.c
new file mode 100644 (file)
index 0000000..2a07620
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target int32plus } */
+
+int b;
+int d;
+void e()
+{
+  unsigned f;
+  unsigned g;
+  int h;
+  long i = 901380;
+  for (;;) {
+      d = 0;
+      for (; d; d++) {
+         h = 143366620;
+         f = 0;
+         for (; f < 15; f += 3) {
+             g = 0;
+             for (; g < 9; g++)
+               b = h = i - (h << 5) + h;
+         }
+      }
+      i = 0;
+  }
+}
index 2717b40485b93b3dd668b14b2a6ce80a816065ef..a218327d772c56b51a25b61c4ee4199af4b34ada 100644 (file)
@@ -328,10 +328,12 @@ chrec_fold_plus_1 (enum tree_code code, tree type,
 
        default:
          {
-           if (tree_contains_chrecs (op0, NULL)
-               || tree_contains_chrecs (op1, NULL))
+           int size = 0;
+           if ((tree_contains_chrecs (op0, &size)
+                || tree_contains_chrecs (op1, &size))
+               && size < PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE))
              return build2 (code, type, op0, op1);
-           else
+           else if (size < PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE))
              {
                if (code == POINTER_PLUS_EXPR)
                  return fold_build_pointer_plus (fold_convert (type, op0),
@@ -341,6 +343,8 @@ chrec_fold_plus_1 (enum tree_code code, tree type,
                                      fold_convert (type, op0),
                                      fold_convert (type, op1));
              }
+           else
+             return chrec_dont_know;
          }
        }
     }