]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use stablesort for sorting association chain
authorRichard Biener <rguenther@suse.de>
Fri, 11 Jun 2021 06:04:41 +0000 (08:04 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 11 Jun 2021 07:29:35 +0000 (09:29 +0200)
This should preserve the original association order as much as possible
for the initial SLP discovery attempt and also improve consistency.

2021-06-11  Richard Biener  <rguenther@suse.de>

* tree-vect-slp.c (vect_build_slp_tree_2): Use stablesort
to sort operands of the associative chain.

gcc/tree-vect-slp.c

index c4f8f38012f70c8334ef7d264cdda907c3b19458..6237a61ffd44ddbc034f7befa3be70c6b23d19b6 100644 (file)
@@ -1865,7 +1865,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
          /* Now we have a set of chains with the same length.  */
          /* 1. pre-sort according to def_type and operation.  */
          for (unsigned lane = 0; lane < group_size; ++lane)
-           chains[lane].sort (dt_sort_cmp, vinfo);
+           chains[lane].stablesort (dt_sort_cmp, vinfo);
          if (dump_enabled_p ())
            {
              dump_printf_loc (MSG_NOTE, vect_location,