re PR tree-optimization/90930 (Excessive memory consumption)
authorRichard Biener <rguenther@suse.de>
Tue, 25 Jun 2019 10:59:48 +0000 (10:59 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 25 Jun 2019 10:59:48 +0000 (10:59 +0000)
2019-06-25  Richard Biener  <rguenther@suse.de>

PR tree-optimization/90930
* tree-ssa-reassoc.c (reassociate_bb): Only rewrite expression
into parallel form in the last pass instance.

* gcc.dg/tree-ssa/reassoc-24.c: Adjust.
* gcc.dg/tree-ssa/reassoc-25.c: Likewise.

From-SVN: r272644

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/reassoc-24.c
gcc/testsuite/gcc.dg/tree-ssa/reassoc-25.c
gcc/tree-ssa-reassoc.c

index d9f3c219121c7d263fa63dea27fc81769a697326..9814b5b85f8fb1e3650644d5a44978b82856c79a 100644 (file)
@@ -1,3 +1,9 @@
+2019-06-25  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90930
+       * tree-ssa-reassoc.c (reassociate_bb): Only rewrite expression
+       into parallel form in the last pass instance.
+
 2019-06-25  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * config/arc/arc.c (arc_symbol_binds_local_p): New function.
index b29a9c2f2cdfd95768db9a81d6133e9e1b5c6761..b147b6766eef4cc265927c199a1d140f5d695fbf 100644 (file)
@@ -1,3 +1,9 @@
+2019-06-25  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90930
+       * gcc.dg/tree-ssa/reassoc-24.c: Adjust.
+       * gcc.dg/tree-ssa/reassoc-25.c: Likewise.
+
 2019-06-25  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * gcc.target/arc/pr89838.c: New file.
index 4503cd740095ef0c8b6b508da45480fd26a66eff..c320d1cb71b103d9e86bd5538c66df3cf8d5d3a6 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 --param tree-reassoc-width=2 -fdump-tree-reassoc1" } */
+/* { dg-options "-O2 --param tree-reassoc-width=2 -fdump-tree-reassoc2" } */
 
 unsigned int
 foo (void)
@@ -21,4 +21,4 @@ foo (void)
 
 /* Verify there are two pairs of __asm__ statements with no
    intervening stmts.  */
-/* { dg-final { scan-tree-dump-times "__asm__\[^;\n]*;\n *__asm__" 2 "reassoc1"} } */
+/* { dg-final { scan-tree-dump-times "__asm__\[^;\n]*;\n *__asm__" 2 "reassoc2"} } */
index 553736bc391e7400bfbb797c1e768233cee3f418..dbb02683778b08b2199e2cb4a9d356f7e8a0fd18 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 --param tree-reassoc-width=3 -fdump-tree-reassoc1-details" } */
+/* { dg-options "-O2 --param tree-reassoc-width=3 -fdump-tree-reassoc2-details" } */
 
 unsigned int
 foo (int a, int b, int c, int d)
@@ -15,4 +15,4 @@ foo (int a, int b, int c, int d)
 }
 
 /* Verify reassociation width was chosen to be 2.  */
-/* { dg-final { scan-tree-dump-times "Width = 2" 1 "reassoc1"} } */
+/* { dg-final { scan-tree-dump-times "Width = 2" 1 "reassoc2"} } */
index 7161c4c36c38012383debbe6d37ff872c2994475..6794fbde29e68781f73a434dba2d37db2f742c3d 100644 (file)
@@ -6013,12 +6013,7 @@ reassociate_bb (basic_block bb)
                {
                  machine_mode mode = TYPE_MODE (TREE_TYPE (lhs));
                  int ops_num = ops.length ();
-                 int width = get_reassociation_width (ops_num, rhs_code, mode);
-
-                 if (dump_file && (dump_flags & TDF_DETAILS))
-                   fprintf (dump_file,
-                            "Width = %d was chosen for reassociation\n", width);
-
+                 int width;
 
                  /* For binary bit operations, if there are at least 3
                     operands and the last last operand in OPS is a constant,
@@ -6032,10 +6027,21 @@ reassociate_bb (basic_block bb)
                      && TREE_CODE (ops.last ()->op) == INTEGER_CST)
                    std::swap (*ops[0], *ops[ops_num - 1]);
 
-                 if (width > 1
-                     && ops.length () > 3)
-                   rewrite_expr_tree_parallel (as_a <gassign *> (stmt),
-                                               width, ops);
+                 /* Only rewrite the expression tree to parallel in the
+                    last reassoc pass to avoid useless work back-and-forth
+                    with initial linearization.  */
+                 if (!reassoc_insert_powi_p
+                     && ops.length () > 3
+                     && (width = get_reassociation_width (ops_num, rhs_code,
+                                                          mode)) > 1)
+                   {
+                     if (dump_file && (dump_flags & TDF_DETAILS))
+                       fprintf (dump_file,
+                                "Width = %d was chosen for reassociation\n",
+                                width);
+                     rewrite_expr_tree_parallel (as_a <gassign *> (stmt),
+                                                 width, ops);
+                   }
                  else
                     {
                       /* When there are three operands left, we want