[PATCH] D152800: [MISched][scheduleDump] Use stable_sort to prevent test failures.
Francesco Petrogalli via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 04:10:50 PDT 2023
fpetrogalli created this revision.
fpetrogalli added a reviewer: RKSimon.
Herald added subscribers: mgrang, javed.absar, hiraditya, MatzeB.
Herald added a project: All.
fpetrogalli requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152800
Files:
llvm/lib/CodeGen/MachineScheduler.cpp
Index: llvm/lib/CodeGen/MachineScheduler.cpp
===================================================================
--- llvm/lib/CodeGen/MachineScheduler.cpp
+++ llvm/lib/CodeGen/MachineScheduler.cpp
@@ -1010,13 +1010,13 @@
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 @@
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 =
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152800.530857.patch
Type: text/x-patch
Size: 2249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230613/d763f51c/attachment.bin>
More information about the llvm-commits
mailing list