This patch improves the updated memory cost in coloring pass of integrated register allocator. Only enter_freq of the loop is considered in updated memory cost in the coloring pass. Consideration of only enter_freq is based on the concept that live Out of the entry or header of the Loop is live in and liveout throughout the loop. Exit freq is ignored in the update memory cost in coloring pass.
This increases the updated memory most and more chances of reducing the spill and fetch and better assignment. The concept of live-out of the header of the loop is live-in and live-out throughout of the Loop is based on the following. If a v live is out at the header of the loop then the variable is live-in at every node in the loop. To prove this, consider a loop L with header h such that the variable v defined at d is live-in at h. Since v is live at h, d is not part of L. This follows from the dominance property, i.e. h is strictly dominated by d. Furthermore, there exists a path from h to a use of v which does not go through d. For every node p in the loop, since the loop is strongly connected and node is a component of the CFG, there exists a path, consisting only of nodes of L from p to h. Concatenating these two paths proves that v is live-in and live-out of p. Bootstrapped on X86_64. Performance run is done on SPEC CPU2000 benchmarks and following are the results. SPEC INT benchmarks (Mean Score with this patch vs Mean score without this patch = 3729.777 vs 3717.083). Benchmarks Gains. 186.crafty = 2.78% 176.gcc = 0.7% 253.perlbmk = 0.75% 255.vortex = 0.82% SPEC FP benchmarks (Mean Score with this patch vs Mean score without this patch = 4774.65 vs 4751.838 ). Benchmarks Gains 168.wupwise = 0.77% 171.swim = 1.5% 177.mesa = 1.2% 200.sixtrack = 1.2% 178.galgel = 0.6% 179.art = 0.6% 183.equake = 0.5% 187.facerec = 0.7%. ChangeLog: 2016-01-23 Ajit Agarwal <ajit...@xilinx.com> * ira-color.c (color_pass): Consider only the enter_freq in calculation of update memory cost. Signed-off-by:Ajit Agarwal ajit...@xilinx.com. --- gcc/ira-color.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/gcc/ira-color.c b/gcc/ira-color.c index 1e4c64f..201017c 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -3173,7 +3173,7 @@ static void color_pass (ira_loop_tree_node_t loop_tree_node) { int regno, hard_regno, index = -1, n; - int cost, exit_freq, enter_freq; + int cost, enter_freq; unsigned int j; bitmap_iterator bi; machine_mode mode; @@ -3297,7 +3297,6 @@ color_pass (ira_loop_tree_node_t loop_tree_node) } continue; } - exit_freq = ira_loop_edge_freq (subloop_node, regno, true); enter_freq = ira_loop_edge_freq (subloop_node, regno, false); ira_assert (regno < ira_reg_equiv_len); if (ira_equiv_no_lvalue_p (regno)) @@ -3315,15 +3314,14 @@ color_pass (ira_loop_tree_node_t loop_tree_node) else if (hard_regno < 0) { ALLOCNO_UPDATED_MEMORY_COST (subloop_allocno) - -= ((ira_memory_move_cost[mode][rclass][1] * enter_freq) - + (ira_memory_move_cost[mode][rclass][0] * exit_freq)); + -= ((ira_memory_move_cost[mode][rclass][1] * enter_freq)); } else { aclass = ALLOCNO_CLASS (subloop_allocno); ira_init_register_move_cost_if_necessary (mode); cost = (ira_register_move_cost[mode][rclass][rclass] - * (exit_freq + enter_freq)); + * (enter_freq)); ira_allocate_and_set_or_copy_costs (&ALLOCNO_UPDATED_HARD_REG_COSTS (subloop_allocno), aclass, ALLOCNO_UPDATED_CLASS_COST (subloop_allocno), @@ -3339,8 +3337,8 @@ color_pass (ira_loop_tree_node_t loop_tree_node) ALLOCNO_UPDATED_CLASS_COST (subloop_allocno) = ALLOCNO_UPDATED_HARD_REG_COSTS (subloop_allocno)[index]; ALLOCNO_UPDATED_MEMORY_COST (subloop_allocno) - += (ira_memory_move_cost[mode][rclass][0] * enter_freq - + ira_memory_move_cost[mode][rclass][1] * exit_freq); + += (ira_memory_move_cost[mode][rclass][0] * enter_freq); + } } } -- 1.7.1 Thanks & Regards Ajit
ira.patch
Description: ira.patch