public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r9-9508] rtl-optimization/98144 - tame REE memory usage
@ 2021-05-04 13:54 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-05-04 13:54 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4595028e7212d6870e9e236f1f5a016b50708b7c

commit r9-9508-g4595028e7212d6870e9e236f1f5a016b50708b7c
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jan 29 10:23:40 2021 +0100

    rtl-optimization/98144 - tame REE memory usage
    
    This changes the REE dataflow to change the explicit all-ones
    starting solution to be implicit via a visited flag, removing
    the need to initially start with fully populated bitmaps for
    all basic-blocks.  That reduces peak memory use when compiling
    the RTL checking enabled insn-extract.c testcase from PR98144
    from 6GB to less than 2GB.
    
    2021-01-29  Richard Biener  <rguenther@suse.de>
    
            PR rtl-optimization/98144
            * df.h (df_mir_bb_info): Add con_visited member.
            * df-problems.c (df_mir_alloc): Initialize con_visited,
            do not fully populate IN and OUT.
            (df_mir_reset): Likewise.
            (df_mir_confluence_0): Set con_visited.
            (df_mir_confluence_n): Properly handle implicitely
            fully populated IN and OUT as designated by con_visited
            and update con_visited accordingly.
    
    (cherry picked from commit a8c455bafdefdab0a7b8cdbcdb116c0086bae05e)

Diff:
---
 gcc/df-problems.c | 28 +++++++++++++++++++++-------
 gcc/df.h          |  1 +
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index a9dfa6203cf..a19eff7b9bb 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -1909,8 +1909,7 @@ df_mir_alloc (bitmap all_blocks)
 	  bitmap_initialize (&bb_info->gen, &problem_data->mir_bitmaps);
 	  bitmap_initialize (&bb_info->in, &problem_data->mir_bitmaps);
 	  bitmap_initialize (&bb_info->out, &problem_data->mir_bitmaps);
-	  bitmap_set_range (&bb_info->in, 0, DF_REG_SIZE (df));
-	  bitmap_set_range (&bb_info->out, 0, DF_REG_SIZE (df));
+	  bb_info->con_visited = false;
 	}
     }
 
@@ -1933,9 +1932,8 @@ df_mir_reset (bitmap all_blocks)
       gcc_assert (bb_info);
 
       bitmap_clear (&bb_info->in);
-      bitmap_set_range (&bb_info->in, 0, DF_REG_SIZE (df));
       bitmap_clear (&bb_info->out);
-      bitmap_set_range (&bb_info->out, 0, DF_REG_SIZE (df));
+      bb_info->con_visited = false;
     }
 }
 
@@ -2013,6 +2011,7 @@ df_mir_confluence_0 (basic_block bb)
   struct df_mir_bb_info *bb_info = df_mir_get_bb_info (bb->index);
 
   bitmap_clear (&bb_info->in);
+  bb_info->con_visited = true;
 }
 
 
@@ -2021,12 +2020,27 @@ df_mir_confluence_0 (basic_block bb)
 static bool
 df_mir_confluence_n (edge e)
 {
-  bitmap op1 = &df_mir_get_bb_info (e->dest->index)->in;
-  bitmap op2 = &df_mir_get_bb_info (e->src->index)->out;
-
   if (e->flags & EDGE_FAKE)
     return false;
 
+  df_mir_bb_info *src_info = df_mir_get_bb_info (e->src->index);
+  /* If SRC was not visited yet then we'll and with all-ones which
+     means no changes.  Do not consider DST con_visited by this
+     operation alone either.  */
+  if (!src_info->con_visited)
+    return false;
+
+  df_mir_bb_info *dst_info = df_mir_get_bb_info (e->dest->index);
+  bitmap op1 = &dst_info->in;
+  bitmap op2 = &src_info->out;
+  /* If DEST was not visited yet just copy the SRC bitmap.  */
+  if (!dst_info->con_visited)
+    {
+      dst_info->con_visited = true;
+      bitmap_copy (op1, op2);
+      return true;
+    }
+
   /* A register is must-initialized at the entry of a basic block iff it is
      must-initialized at the exit of all the predecessors.  */
   return bitmap_and_into (op1, op2);
diff --git a/gcc/df.h b/gcc/df.h
index d76d31baa84..d522188bfb4 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -922,6 +922,7 @@ struct df_mir_bb_info
   /* The results of the dataflow problem.  */
   bitmap_head in;    /* At the top of the block.  */
   bitmap_head out;   /* At the bottom of the block.  */
+  bool con_visited;  /* Visited by con_fun_{0,n}.  */
 };


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

only message in thread, other threads:[~2021-05-04 13:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 13:54 [gcc r9-9508] rtl-optimization/98144 - tame REE memory usage Richard Biener

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).