From: Alexander Monakov Date: Tue, 19 Sep 2017 10:16:20 +0000 (+0300) Subject: lra: make reload_pseudo_compare_func a proper comparator X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ffaea1170332667a1533a354dfcedc6d0de4aa5e;p=gcc.git lra: make reload_pseudo_compare_func a proper comparator PR rtl-optimization/57878 PR rtl-optimization/68988 * lra-assigns.c (reload_pseudo_compare_func): Remove fragmentation avoidance test involving non_reload_pseudos. Move frequency test below the general fragmentation avoidance test. From-SVN: r252972 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a7841b068f7..bc732f93a39 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-09-19 Alexander Monakov + + PR rtl-optimization/57878 + PR rtl-optimization/68988 + * lra-assigns.c (reload_pseudo_compare_func): Remove fragmentation + avoidance test involving non_reload_pseudos. Move frequency test + below the general fragmentation avoidance test. + 2017-09-19 Richard Biener PR tree-optimization/69728 diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c index 9208fccfd59..5a65c7c8c5f 100644 --- a/gcc/lra-assigns.c +++ b/gcc/lra-assigns.c @@ -211,24 +211,15 @@ reload_pseudo_compare_func (const void *v1p, const void *v2p) if ((diff = (ira_class_hard_regs_num[cl1] - ira_class_hard_regs_num[cl2])) != 0) return diff; - if ((diff - = (ira_reg_class_max_nregs[cl2][lra_reg_info[r2].biggest_mode] - - ira_reg_class_max_nregs[cl1][lra_reg_info[r1].biggest_mode])) != 0 - /* The code below executes rarely as nregs == 1 in most cases. - So we should not worry about using faster data structures to - check reload pseudos. */ - && ! bitmap_bit_p (&non_reload_pseudos, r1) - && ! bitmap_bit_p (&non_reload_pseudos, r2)) - return diff; - if ((diff = (regno_assign_info[regno_assign_info[r2].first].freq - - regno_assign_info[regno_assign_info[r1].first].freq)) != 0) - return diff; /* Allocate bigger pseudos first to avoid register file fragmentation. */ if ((diff = (ira_reg_class_max_nregs[cl2][lra_reg_info[r2].biggest_mode] - ira_reg_class_max_nregs[cl1][lra_reg_info[r1].biggest_mode])) != 0) return diff; + if ((diff = (regno_assign_info[regno_assign_info[r2].first].freq + - regno_assign_info[regno_assign_info[r1].first].freq)) != 0) + return diff; /* Put pseudos from the thread nearby. */ if ((diff = regno_assign_info[r1].first - regno_assign_info[r2].first) != 0) return diff;