diff options
author | Francesco Petrogalli <francesco.petrogalli@apple.com> | 2023-06-13 14:04:05 +0200 |
---|---|---|
committer | Francesco Petrogalli <francesco.petrogalli@apple.com> | 2023-06-13 14:40:29 +0200 |
commit | 623295a1d0cc8d0ace354b1b97959df49be8a86e (patch) | |
tree | d802846b9c001bf866d6ac6ec593cf28ec6979ce /llvm/lib/CodeGen/MachineScheduler.cpp | |
parent | 8d1edae998fb40bbb22c5b5146eb333cf6148b35 (diff) | |
download | llvm-623295a1d0cc8d0ace354b1b97959df49be8a86e.zip llvm-623295a1d0cc8d0ace354b1b97959df49be8a86e.tar.gz llvm-623295a1d0cc8d0ace354b1b97959df49be8a86e.tar.bz2 |
[MISched][scheduleDump] Use stable_sort to prevent test failures.
When building the compiler with -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON,
sometimes resources that are dumped in scheduled traces gets reordered
even if they are booked in the same cycle. Using `stable_sort`
guarantees that such occasional reordering does not happen.
This change should fix failures like the one seen in
https://lab.llvm.org/buildbot/#/builders/16/builds/49592.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D152800
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineScheduler.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index b41b2d8..28b17f7 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/lib/CodeGen/MachineScheduler.cpp @@ -1010,13 +1010,13 @@ LLVM_DUMP_METHOD void ScheduleDAGMI::dumpScheduleTraceTopDown() const { SchedModel.getWriteProcResEnd(SC))); if (MISchedSortResourcesInTrace) - llvm::sort(ResourcesIt.begin(), ResourcesIt.end(), - [](const MCWriteProcResEntry &LHS, - const MCWriteProcResEntry &RHS) -> bool { - return LHS.StartAtCycle < RHS.StartAtCycle || - (LHS.StartAtCycle == RHS.StartAtCycle && - LHS.Cycles < RHS.Cycles); - }); + llvm::stable_sort(ResourcesIt, + [](const MCWriteProcResEntry &LHS, + const MCWriteProcResEntry &RHS) -> bool { + return LHS.StartAtCycle < RHS.StartAtCycle || + (LHS.StartAtCycle == RHS.StartAtCycle && + LHS.Cycles < RHS.Cycles); + }); for (const MCWriteProcResEntry &PI : ResourcesIt) { C = FirstCycle; const std::string ResName = @@ -1090,13 +1090,13 @@ LLVM_DUMP_METHOD void ScheduleDAGMI::dumpScheduleTraceBottomUp() const { SchedModel.getWriteProcResEnd(SC))); if (MISchedSortResourcesInTrace) - llvm::sort(ResourcesIt.begin(), ResourcesIt.end(), - [](const MCWriteProcResEntry &LHS, - const MCWriteProcResEntry &RHS) -> bool { - return LHS.StartAtCycle < RHS.StartAtCycle || - (LHS.StartAtCycle == RHS.StartAtCycle && - LHS.Cycles < RHS.Cycles); - }); + llvm::stable_sort(ResourcesIt, + [](const MCWriteProcResEntry &LHS, + const MCWriteProcResEntry &RHS) -> bool { + return LHS.StartAtCycle < RHS.StartAtCycle || + (LHS.StartAtCycle == RHS.StartAtCycle && + LHS.Cycles < RHS.Cycles); + }); for (const MCWriteProcResEntry &PI : ResourcesIt) { C = FirstCycle; const std::string ResName = |