[llvm] [BOLT] Use llvm::stable_sort (NFC) (PR #140429)

via llvm-commits llvm-commits at lists.llvm.org
Sat May 17 20:08:31 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/140429.diff


1 Files Affected:

- (modified) bolt/lib/Passes/ShrinkWrapping.cpp (+7-8) 


``````````diff
diff --git a/bolt/lib/Passes/ShrinkWrapping.cpp b/bolt/lib/Passes/ShrinkWrapping.cpp
index 176321c58dc90..4ea60f388e2fa 100644
--- a/bolt/lib/Passes/ShrinkWrapping.cpp
+++ b/bolt/lib/Passes/ShrinkWrapping.cpp
@@ -825,14 +825,13 @@ void ShrinkWrapping::computeSaveLocations() {
     if (!CSA.CalleeSaved[I])
       continue;
 
-    std::stable_sort(BestSavePos[I].begin(), BestSavePos[I].end(),
-                     [&](const MCInst *A, const MCInst *B) {
-                       const BinaryBasicBlock *BBA = InsnToBB[A];
-                       const BinaryBasicBlock *BBB = InsnToBB[B];
-                       const uint64_t CountA = BBA->getKnownExecutionCount();
-                       const uint64_t CountB = BBB->getKnownExecutionCount();
-                       return CountB < CountA;
-                     });
+    llvm::stable_sort(BestSavePos[I], [&](const MCInst *A, const MCInst *B) {
+      const BinaryBasicBlock *BBA = InsnToBB[A];
+      const BinaryBasicBlock *BBB = InsnToBB[B];
+      const uint64_t CountA = BBA->getKnownExecutionCount();
+      const uint64_t CountB = BBB->getKnownExecutionCount();
+      return CountB < CountA;
+    });
 
     for (MCInst *Pos : BestSavePos[I]) {
       const BinaryBasicBlock *BB = InsnToBB[Pos];

``````````

</details>


https://github.com/llvm/llvm-project/pull/140429


More information about the llvm-commits mailing list