Commit 6541e97d by Richard Sandiford Committed by Richard Sandiford

DF usage in loop-invariant.c (PR46590)

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

From-SVN: r270142
parent 325d3f46
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> 2019-04-03 qing zhao <qing.zhao@oracle.com>
PR tree-optimization/89730 PR tree-optimization/89730
......
...@@ -681,11 +681,7 @@ find_defs (struct loop *loop) ...@@ -681,11 +681,7 @@ find_defs (struct loop *loop)
loop->num); loop->num);
} }
df_remove_problem (df_chain);
df_process_deferred_rescans ();
df_chain_add_problem (DF_UD_CHAIN); 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_set_flags (DF_RD_PRUNE_DEAD_DEFS);
df_analyze_loop (loop); df_analyze_loop (loop);
check_invariant_table_size (); check_invariant_table_size ();
...@@ -1891,6 +1887,10 @@ move_invariants (struct loop *loop) ...@@ -1891,6 +1887,10 @@ move_invariants (struct loop *loop)
GENERAL_REGS, NO_REGS, GENERAL_REGS); 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. */ /* Initializes invariant motion data. */
...@@ -2254,6 +2254,14 @@ move_loop_invariants (void) ...@@ -2254,6 +2254,14 @@ move_loop_invariants (void)
{ {
struct loop *loop; 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) if (flag_ira_loop_pressure)
{ {
df_analyze (); df_analyze ();
...@@ -2286,5 +2294,8 @@ move_loop_invariants (void) ...@@ -2286,5 +2294,8 @@ move_loop_invariants (void)
invariant_table = NULL; invariant_table = NULL;
invariant_table_size = 0; invariant_table_size = 0;
if (optimize == 1)
df_remove_problem (df_live);
checking_verify_flow_info (); checking_verify_flow_info ();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment