tree-ssa-loop-im.c (sort_bbs_in_loop_postorder_cmp): Stabilize sort.
authorCory Fields <cory-nospam-@coryfields.com>
Mon, 15 Jan 2018 06:05:50 +0000 (06:05 +0000)
committerJeff Law <law@gcc.gnu.org>
Mon, 15 Jan 2018 06:05:50 +0000 (23:05 -0700)
* tree-ssa-loop-im.c (sort_bbs_in_loop_postorder_cmp): Stabilize sort.
* ira-color (allocno_hard_regs_compare): Likewise.

From-SVN: r256682

gcc/ChangeLog
gcc/ira-color.c
gcc/tree-ssa-loop-im.c

index abd0e3178664e86b7a8e9486eb0a5a95b09f8d58..0d908279e9c8f6e2452723114cc359ee52c8a04f 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-14  Cory Fields  <cory-nospam-@coryfields.com>
+
+       * tree-ssa-loop-im.c (sort_bbs_in_loop_postorder_cmp): Stabilize sort.
+       * ira-color (allocno_hard_regs_compare): Likewise.
+
 2018-01-14  Nathan Rossi  <nathan@nathanrossi.com>
 
         PR target/83013
index c8b6ab4bcdf541b1385f2d75f4c7cb75461544fd..26b18f3b15de80f0f67f25435b0f285a5d70503f 100644 (file)
@@ -300,8 +300,7 @@ allocno_hard_regs_compare (const void *v1p, const void *v2p)
     return 1;
   else if (hv2->cost < hv1->cost)
     return -1;
-  else
-    return 0;
+  return SORTGT (allocno_hard_regs_hasher::hash(hv2), allocno_hard_regs_hasher::hash(hv1));
 }
 
 \f
index 7d95621868143489dbfa80fb429b98c1101b3e45..7864fbd1fb5969b022f3480f05049a22f9adb065 100644 (file)
@@ -1496,7 +1496,7 @@ sort_bbs_in_loop_postorder_cmp (const void *bb1_, const void *bb2_)
   struct loop *loop1 = bb1->loop_father;
   struct loop *loop2 = bb2->loop_father;
   if (loop1->num == loop2->num)
-    return 0;
+    return bb1->index - bb2->index;
   return bb_loop_postorder[loop1->num] < bb_loop_postorder[loop2->num] ? -1 : 1;
 }