From bd38234d76035d540e71e40322a92a7d6c68d454 Mon Sep 17 00:00:00 2001 From: Sterling Augustine Date: Thu, 17 Mar 2022 10:01:49 -0700 Subject: [PATCH] Reland "Use a stable-sort when combining bases" Differential Revision: https://reviews.llvm.org/D121922 --- llvm/lib/Target/ARM/ARMISelLowering.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 583b6b8..52d1734 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(); -- 2.7.4