[llvm] [TableGen] Fix ordering of register classes. (PR #67245)
Ivan Kosarev via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 23 13:30:36 PDT 2023
https://github.com/kosarev created https://github.com/llvm/llvm-project/pull/67245
This commit:
TableGen: Try to fix expensive checks failures
d2a9b87fee84766b28bd39b46c913da00e1450f4
fixed one of the sort() calls, but there's another.
Caught on expensive-checks buildbots that started to fail sporadically after submitting
[AMDGPU] Add True16 register classes.
469b3bfad20550968ac428738eb1f8bb8ce3e96d
>From 805c7370472505d3cd6a5e53b5d4a45145279961 Mon Sep 17 00:00:00 2001
From: Ivan Kosarev <ivan.kosarev at amd.com>
Date: Sat, 23 Sep 2023 20:24:02 +0100
Subject: [PATCH] [TableGen] Fix ordering of register classes.
This commit:
TableGen: Try to fix expensive checks failures
d2a9b87fee84766b28bd39b46c913da00e1450f4
fixed one of the sort() calls, but there's another.
Caught on expensive-checks buildbots that started to fail sporadically
after submitting
[AMDGPU] Add True16 register classes.
469b3bfad20550968ac428738eb1f8bb8ce3e96d
---
llvm/utils/TableGen/CodeGenRegisters.cpp | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/llvm/utils/TableGen/CodeGenRegisters.cpp b/llvm/utils/TableGen/CodeGenRegisters.cpp
index b8dde6e946a422f..bbe0bc9eafebbbe 100644
--- a/llvm/utils/TableGen/CodeGenRegisters.cpp
+++ b/llvm/utils/TableGen/CodeGenRegisters.cpp
@@ -1036,8 +1036,8 @@ void CodeGenRegisterClass::computeSubClasses(CodeGenRegBank &RegBank) {
std::optional<std::pair<CodeGenRegisterClass *, CodeGenRegisterClass *>>
CodeGenRegisterClass::getMatchingSubClassWithSubRegs(
CodeGenRegBank &RegBank, const CodeGenSubRegIndex *SubIdx) const {
- auto SizeOrder = [this](const CodeGenRegisterClass *A,
- const CodeGenRegisterClass *B) {
+ auto WeakSizeOrder = [this](const CodeGenRegisterClass *A,
+ const CodeGenRegisterClass *B) {
// If there are multiple, identical register classes, prefer the original
// register class.
if (A == B)
@@ -1059,7 +1059,7 @@ CodeGenRegisterClass::getMatchingSubClassWithSubRegs(
for (auto &RC : RegClasses)
if (SuperRegRCsBV[RC.EnumValue])
SuperRegRCs.emplace_back(&RC);
- llvm::stable_sort(SuperRegRCs, SizeOrder);
+ llvm::stable_sort(SuperRegRCs, WeakSizeOrder);
assert(SuperRegRCs.front() == BiggestSuperRegRC &&
"Biggest class wasn't first");
@@ -1072,11 +1072,11 @@ CodeGenRegisterClass::getMatchingSubClassWithSubRegs(
if (SuperRegClassesBV.any())
SuperRegClasses.push_back(std::make_pair(&RC, SuperRegClassesBV));
}
- llvm::sort(SuperRegClasses,
- [&](const std::pair<CodeGenRegisterClass *, BitVector> &A,
- const std::pair<CodeGenRegisterClass *, BitVector> &B) {
- return SizeOrder(A.first, B.first);
- });
+ llvm::stable_sort(SuperRegClasses,
+ [&](const std::pair<CodeGenRegisterClass *, BitVector> &A,
+ const std::pair<CodeGenRegisterClass *, BitVector> &B) {
+ return WeakSizeOrder(A.first, B.first);
+ });
// Find the biggest subclass and subreg class such that R:subidx is in the
// subreg class for all R in subclass.
More information about the llvm-commits
mailing list