lra: make reload_pseudo_compare_func a proper comparator
authorAlexander Monakov <amonakov@ispras.ru>
Tue, 19 Sep 2017 10:16:20 +0000 (13:16 +0300)
committerAlexander Monakov <amonakov@gcc.gnu.org>
Tue, 19 Sep 2017 10:16:20 +0000 (13:16 +0300)
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

gcc/ChangeLog
gcc/lra-assigns.c

index a7841b068f736c9f3c2b233bd63a2712467949d1..bc732f93a3923afd2fc4cca940b07a7f5beaad8f 100644 (file)
@@ -1,3 +1,11 @@
+2017-09-19  Alexander Monakov  <amonakov@ispras.ru>
+
+       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  <rguenther@suse.de>
 
        PR tree-optimization/69728
index 9208fccfd597f1619f10ee2498234eb8bb8fa37b..5a65c7c8c5f9d520b7d0c9998756996a6db67a57 100644 (file)
@@ -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;