From 6541e97d4da7df25f948e544fc09271a91aee8f8 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 4 Apr 2019 07:35:34 +0000 Subject: [PATCH] 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 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 --- gcc/ChangeLog | 12 ++++++++++++ gcc/loop-invariant.c | 19 +++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4099ce66307..47eeed65ab7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2019-04-04 Richard Sandiford + + 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 PR tree-optimization/89730 diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index 3e82f1e10d5..b880ead3d15 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -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 (); } -- 2.30.2