]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
DF usage in loop-invariant.c (PR46590)
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 4 Apr 2019 07:35:34 +0000 (07:35 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 4 Apr 2019 07:35:34 +0000 (07:35 +0000)
- df_live is already present at -O2, so we only need to add it and
  mark all blocks dirty for -O

- df_process_deferred_rescans should be enough to force a rescan of
  blocks affected by moving invariants, but calling it in find_defs
  means that we don't do any rescans for the final loop

2019-04-04  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR rtl-optimization/46590
* loop-invariant.c (find_defs): Move df_remove_problem and
df_process_deferred_rescans to move_invariants.
Move df_live_add_problem and df_live_set_all_dirty calls
to move_invariants.
(move_invariants): Likewise.
(move_loop_invariants): Likewise, making the df_live calls
conditional on -O.  Remove the problem again if we added it
locally.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@270142 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/loop-invariant.c

index 4099ce66307fed29aa28b3d94201e9d90f02d24a..47eeed65ab7cfe965ae718591624d11e63f10921 100644 (file)
@@ -1,3 +1,15 @@
+2019-04-04  Richard Sandiford  <richard.sandiford@arm.com>
+
+       PR rtl-optimization/46590
+       * loop-invariant.c (find_defs): Move df_remove_problem and
+       df_process_deferred_rescans to move_invariants.
+       Move df_live_add_problem and df_live_set_all_dirty calls
+       to move_invariants.
+       (move_invariants): Likewise.
+       (move_loop_invariants): Likewise, making the df_live calls
+       conditional on -O.  Remove the problem again if we added it
+       locally.
+
 2019-04-03  qing zhao  <qing.zhao@oracle.com>
 
        PR tree-optimization/89730
index 3e82f1e10d5e5b867af315e1378915cdff8e5ef4..b880ead3d15fad0cd7f56712705be3e3d3c67f87 100644 (file)
@@ -681,11 +681,7 @@ find_defs (struct loop *loop)
               loop->num);
     }
 
-  df_remove_problem (df_chain);
-  df_process_deferred_rescans ();
   df_chain_add_problem (DF_UD_CHAIN);
-  df_live_add_problem ();
-  df_live_set_all_dirty ();
   df_set_flags (DF_RD_PRUNE_DEAD_DEFS);
   df_analyze_loop (loop);
   check_invariant_table_size ();
@@ -1891,6 +1887,10 @@ move_invariants (struct loop *loop)
                                 GENERAL_REGS, NO_REGS, GENERAL_REGS);
          }
     }
+  /* Remove the DF_UD_CHAIN problem added in find_defs before rescanning,
+     to save a bit of compile time.  */
+  df_remove_problem (df_chain);
+  df_process_deferred_rescans ();
 }
 
 /* Initializes invariant motion data.  */
@@ -2254,6 +2254,14 @@ move_loop_invariants (void)
 {
   struct loop *loop;
 
+  if (optimize == 1)
+    df_live_add_problem ();
+  /* ??? This is a hack.  We should only need to call df_live_set_all_dirty
+     for optimize == 1, but can_move_invariant_reg relies on DF_INSN_LUID
+     being up-to-date.  That isn't always true (even after df_analyze)
+     because df_process_deferred_rescans doesn't necessarily cause
+     blocks to be rescanned.  */
+  df_live_set_all_dirty ();
   if (flag_ira_loop_pressure)
     {
       df_analyze ();
@@ -2286,5 +2294,8 @@ move_loop_invariants (void)
   invariant_table = NULL;
   invariant_table_size = 0;
 
+  if (optimize == 1)
+    df_remove_problem (df_live);
+
   checking_verify_flow_info ();
 }