[llvm] 623295a - [MISched][scheduleDump] Use stable_sort to prevent test failures.
Francesco Petrogalli via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 05:43:58 PDT 2023
Author: Francesco Petrogalli
Date: 2023-06-13T14:40:29+02:00
New Revision: 623295a1d0cc8d0ace354b1b97959df49be8a86e
URL: https://github.com/llvm/llvm-project/commit/623295a1d0cc8d0ace354b1b97959df49be8a86e
DIFF: https://github.com/llvm/llvm-project/commit/623295a1d0cc8d0ace354b1b97959df49be8a86e.diff
LOG: [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
Added:
Modified:
llvm/lib/CodeGen/MachineScheduler.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index b41b2d83f01c4..28b17f76c99e2 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 =
More information about the llvm-commits
mailing list