[llvm] bd38234 - Reland "Use a stable-sort when combining bases"

Sterling Augustine via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 11:32:31 PDT 2022


Author: Sterling Augustine
Date: 2022-03-17T11:32:16-07:00
New Revision: bd38234d76035d540e71e40322a92a7d6c68d454

URL: https://github.com/llvm/llvm-project/commit/bd38234d76035d540e71e40322a92a7d6c68d454
DIFF: https://github.com/llvm/llvm-project/commit/bd38234d76035d540e71e40322a92a7d6c68d454.diff

LOG: Reland "Use a stable-sort when combining bases"

Differential Revision: https://reviews.llvm.org/D121922

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 583b6b8afb5f3..52d173439e463 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -15977,10 +15977,10 @@ static SDValue CombineBaseUpdate(SDNode *N,
   // 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();


        


More information about the llvm-commits mailing list