On Fri, 29 Jan 2021, Jan Hubicka wrote:

> > This removes adding very expensive DF problems which we do not
> > use and which somehow cause 5GB of memory to leak.
> 
> Impressive :)
> > 
> > Bootstrap & regtest running on x86_64-unknown-linux-gnu.
> > 
> > 2021-01-29  Richard Biener  <rguent...@suse.de>
> > 
> >     PR rtl-optimization/98863
> >     * config/i386/i386-features.c (remove_partial_avx_dependency):
> >     Do not add DF chain and MD problems.
> OK (if regtests passes :)

After discussion on IRC I am testing the following which removes
the unneded df_analyze completely.

Bootstrap / regtest running on x86_64-unkown-linux-gnu.

Still OK if testing passes (I'll also build/test WRF which triggered
this work)

Richard.

>From 1657183c8cdbaea329df47fe4d76c4f871a06bdc Mon Sep 17 00:00:00 2001
From: Richard Biener <rguent...@suse.de>
Date: Fri, 29 Jan 2021 16:02:36 +0100
Subject: [PATCH] rtl-optimization/98863 - tame i386 specific RPAD pass
To: gcc-patches@gcc.gnu.org

This removes analyzing DF with expensive problems which we do not
use at all and which somehow cause 5GB of memory to leak.  Instead
just do a defered rescan of added insns.

2021-01-29  Richard Biener  <rguent...@suse.de>

        PR rtl-optimization/98863
        * config/i386/i386-features.c (remove_partial_avx_dependency):
        Do not perform DF analysis.
        (pass_data_remove_partial_avx_dependency): Remove
        TODO_df_finish.
---
 gcc/config/i386/i386-features.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/gcc/config/i386/i386-features.c b/gcc/config/i386/i386-features.c
index ef4f9406102..c845ba90caf 100644
--- a/gcc/config/i386/i386-features.c
+++ b/gcc/config/i386/i386-features.c
@@ -2272,6 +2272,9 @@ remove_partial_avx_dependency (void)
 
   auto_vec<rtx_insn *> control_flow_insns;
 
+  /* We create invalid RTL initially so defer rescans.  */
+  df_set_flags (DF_DEFER_INSN_RESCAN);
+
   FOR_EACH_BB_FN (bb, cfun)
     {
       FOR_BB_INSNS (bb, insn)
@@ -2292,14 +2295,7 @@ remove_partial_avx_dependency (void)
            continue;
 
          if (!v4sf_const0)
-           {
-             calculate_dominance_info (CDI_DOMINATORS);
-             df_set_flags (DF_DEFER_INSN_RESCAN);
-             df_chain_add_problem (DF_DU_CHAIN | DF_UD_CHAIN);
-             df_md_add_problem ();
-             df_analyze ();
-             v4sf_const0 = gen_reg_rtx (V4SFmode);
-           }
+           v4sf_const0 = gen_reg_rtx (V4SFmode);
 
          /* Convert PARTIAL_XMM_UPDATE_TRUE insns, DF -> SF, SF -> DF,
             SI -> SF, SI -> DF, DI -> SF, DI -> DF, to vec_dup and
@@ -2360,6 +2356,7 @@ remove_partial_avx_dependency (void)
     {
       /* (Re-)discover loops so that bb->loop_father can be used in the
         analysis below.  */
+      calculate_dominance_info (CDI_DOMINATORS);
       loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
 
       /* Generate a vxorps at entry of the nearest dominator for basic
@@ -2391,7 +2388,6 @@ remove_partial_avx_dependency (void)
        set_insn = emit_insn_after (set,
                                    insn ? PREV_INSN (insn) : BB_END (bb));
       df_insn_rescan (set_insn);
-      df_process_deferred_rescans ();
       loop_optimizer_finalize ();
 
       if (!control_flow_insns.is_empty ())
@@ -2412,6 +2408,7 @@ remove_partial_avx_dependency (void)
        }
     }
 
+  df_process_deferred_rescans ();
   bitmap_obstack_release (NULL);
   BITMAP_FREE (convert_bbs);
 
@@ -2441,7 +2438,7 @@ const pass_data pass_data_remove_partial_avx_dependency =
   0, /* properties_provided */
   0, /* properties_destroyed */
   0, /* todo_flags_start */
-  TODO_df_finish, /* todo_flags_finish */
+  0, /* todo_flags_finish */
 };
 
 class pass_remove_partial_avx_dependency : public rtl_opt_pass
-- 
2.26.2

Reply via email to