public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ibm/heads/gcc-9)] backport: re PR tree-optimization/90930 (Excessive memory consumption)
@ 2020-02-04 20:56 Peter Bergner
  0 siblings, 0 replies; only message in thread
From: Peter Bergner @ 2020-02-04 20:56 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:949b1f43b4acc3ba527879a01acbcee67d7c3481

commit 949b1f43b4acc3ba527879a01acbcee67d7c3481
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Nov 11 16:07:54 2019 +0000

    backport: re PR tree-optimization/90930 (Excessive memory consumption)
    
    2019-11-11  Richard Biener  <rguenther@suse.de>
    
    	Backport from mainline
    	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: r278059

Diff:
---
 gcc/ChangeLog                              |  9 +++++++++
 gcc/testsuite/ChangeLog                    |  9 +++++++++
 gcc/testsuite/gcc.dg/tree-ssa/reassoc-24.c |  4 ++--
 gcc/testsuite/gcc.dg/tree-ssa/reassoc-25.c |  4 ++--
 gcc/tree-ssa-reassoc.c                     | 26 ++++++++++++++++----------
 5 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8552b2a..c0ef379 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2019-11-11  Richard Biener  <rguenther@suse.de>
+
+	Backport from mainline
+	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-11-11  H.J. Lu  <hjl.tools@gmail.com>
 
 	Backport from trunk:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 304b405..f77cdb4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2019-11-11  Richard Biener  <rguenther@suse.de>
+
+	Backport from mainline
+	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-11-10  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
 	Backport from trunk
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-24.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-24.c
index 4503cd7..c320d1c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-24.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-24.c
@@ -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"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-25.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-25.c
index 553736b..dbb0268 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-25.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-25.c
@@ -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"} } */
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 7161c4c..6794fbd 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-04 20:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 20:56 [gcc(refs/vendors/ibm/heads/gcc-9)] backport: re PR tree-optimization/90930 (Excessive memory consumption) Peter Bergner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).