[PATCH] D121922: Reland "Use a stable-sort when combining bases"

Sterling Augustine via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 10:02:17 PDT 2022


saugustine created this revision.
Herald added subscribers: mgrang, hiraditya.
Herald added a project: All.
saugustine requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121922

Files:
  llvm/lib/Target/ARM/ARMISelLowering.cpp


Index: llvm/lib/Target/ARM/ARMISelLowering.cpp
===================================================================
--- llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -15977,10 +15977,10 @@
   // Try to fold with other users. Non-constant updates are considered
   // first, and constant updates are sorted to not break a sequence of
   // strided accesses (if there is any).
-  std::sort(BaseUpdates.begin(), BaseUpdates.end(),
-            [](BaseUpdateUser &LHS, BaseUpdateUser &RHS) {
-              return LHS.ConstInc < RHS.ConstInc;
-            });
+  std::stable_sort(BaseUpdates.begin(), BaseUpdates.end(),
+                   [](const BaseUpdateUser &LHS, const BaseUpdateUser &RHS) {
+                     return LHS.ConstInc < RHS.ConstInc;
+                   });
   for (BaseUpdateUser &User : BaseUpdates) {
     if (TryCombineBaseUpdate(Target, User, /*SimpleConstIncOnly=*/false, DCI))
       return SDValue();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121922.416220.patch
Type: text/x-patch
Size: 968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220317/0d81c09d/attachment.bin>


More information about the llvm-commits mailing list