[llvm] TableGen: Sort RuntimeLibcallImpls secondarily by enum names (PR #150728)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 25 18:02:19 PDT 2025
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/150728
Extracted from #150192, this hopefully fixes occasional EXPENSIVE_CHECKS
failures.
>From 0d55e9421d5f01e97149b25afcc4d143c69c8bf2 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Sat, 26 Jul 2025 09:52:13 +0900
Subject: [PATCH] TableGen: Sort RuntimeLibcallImpls secondarily by enum names
Extracted from #150192, this hopefully fixes occasional EXPENSIVE_CHECKS
failures.
---
llvm/test/TableGen/RuntimeLibcallEmitter.td | 6 +++---
llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp | 9 ++++-----
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/llvm/test/TableGen/RuntimeLibcallEmitter.td b/llvm/test/TableGen/RuntimeLibcallEmitter.td
index 579e3c7dd62ab..783a861cfe756 100644
--- a/llvm/test/TableGen/RuntimeLibcallEmitter.td
+++ b/llvm/test/TableGen/RuntimeLibcallEmitter.td
@@ -95,8 +95,8 @@ def BlahLibrary : SystemRuntimeLibrary<isBlahArch, (add calloc, LibraryWithCondi
// CHECK-NEXT: __lshrdi3 = 4, // __lshrdi3
// CHECK-NEXT: bzero = 5, // bzero
// CHECK-NEXT: calloc = 6, // calloc
-// CHECK-NEXT: sqrtl_f80 = 7, // sqrtl
-// CHECK-NEXT: sqrtl_f128 = 8, // sqrtl
+// CHECK-NEXT: sqrtl_f128 = 7, // sqrtl
+// CHECK-NEXT: sqrtl_f80 = 8, // sqrtl
// CHECK-NEXT: NumLibcallImpls = 9
// CHECK-NEXT: };
// CHECK-NEXT: } // End namespace RTLIB
@@ -157,8 +157,8 @@ def BlahLibrary : SystemRuntimeLibrary<isBlahArch, (add calloc, LibraryWithCondi
// CHECK-NEXT: RTLIB::SRL_I64, // RTLIB::__lshrdi3
// CHECK-NEXT: RTLIB::BZERO, // RTLIB::bzero
// CHECK-NEXT: RTLIB::CALLOC, // RTLIB::calloc
-// CHECK-NEXT: RTLIB::SQRT_F80, // RTLIB::sqrtl_f80
// CHECK-NEXT: RTLIB::SQRT_F128, // RTLIB::sqrtl_f128
+// CHECK-NEXT: RTLIB::SQRT_F80, // RTLIB::sqrtl_f80
// CHECK-NEXT: };
diff --git a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
index 7f90d6b4fdacc..a280604ade2e8 100644
--- a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
+++ b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
@@ -242,11 +242,10 @@ class RuntimeLibcallEmitter {
SmallVector<const Record *, 1024> AllRuntimeLibcallImpls(
AllRuntimeLibcallImplsRaw);
- // Sort by libcall impl name, not the enum name. This keeps the order
- // suitable for using the name table for libcall recognition binary search.
- llvm::sort(AllRuntimeLibcallImpls, [](const Record *A, const Record *B) {
- return A->getValueAsString("LibCallFuncName") <
- B->getValueAsString("LibCallFuncName");
+ // Sort by libcall impl name and secondarily by the enum name.
+ sort(AllRuntimeLibcallImpls, [](const Record *A, const Record *B) {
+ return std::pair(A->getValueAsString("LibCallFuncName"), A->getName()) <
+ std::pair(B->getValueAsString("LibCallFuncName"), B->getName());
});
RuntimeLibcallImplDefList.reserve(AllRuntimeLibcallImpls.size());
More information about the llvm-commits
mailing list