Skip to content

Commit b279156

Browse files
committed
TableGen: Sort RuntimeLibcallImpls secondarily by enum names
Extracted from #150192, this hopefully fixes occasional EXPENSIVE_CHECKS failures.
1 parent 1461a1c commit b279156

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

llvm/test/TableGen/RuntimeLibcallEmitter.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ def BlahLibrary : SystemRuntimeLibrary<isBlahArch, (add calloc, LibraryWithCondi
9595
// CHECK-NEXT: __lshrdi3 = 4, // __lshrdi3
9696
// CHECK-NEXT: bzero = 5, // bzero
9797
// CHECK-NEXT: calloc = 6, // calloc
98-
// CHECK-NEXT: sqrtl_f80 = 7, // sqrtl
99-
// CHECK-NEXT: sqrtl_f128 = 8, // sqrtl
98+
// CHECK-NEXT: sqrtl_f128 = 7, // sqrtl
99+
// CHECK-NEXT: sqrtl_f80 = 8, // sqrtl
100100
// CHECK-NEXT: NumLibcallImpls = 9
101101
// CHECK-NEXT: };
102102
// CHECK-NEXT: } // End namespace RTLIB
@@ -157,8 +157,8 @@ def BlahLibrary : SystemRuntimeLibrary<isBlahArch, (add calloc, LibraryWithCondi
157157
// CHECK-NEXT: RTLIB::SRL_I64, // RTLIB::__lshrdi3
158158
// CHECK-NEXT: RTLIB::BZERO, // RTLIB::bzero
159159
// CHECK-NEXT: RTLIB::CALLOC, // RTLIB::calloc
160-
// CHECK-NEXT: RTLIB::SQRT_F80, // RTLIB::sqrtl_f80
161160
// CHECK-NEXT: RTLIB::SQRT_F128, // RTLIB::sqrtl_f128
161+
// CHECK-NEXT: RTLIB::SQRT_F80, // RTLIB::sqrtl_f80
162162
// CHECK-NEXT: };
163163

164164

llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,10 @@ class RuntimeLibcallEmitter {
242242
SmallVector<const Record *, 1024> AllRuntimeLibcallImpls(
243243
AllRuntimeLibcallImplsRaw);
244244

245-
// Sort by libcall impl name, not the enum name. This keeps the order
246-
// suitable for using the name table for libcall recognition binary search.
247-
llvm::sort(AllRuntimeLibcallImpls, [](const Record *A, const Record *B) {
248-
return A->getValueAsString("LibCallFuncName") <
249-
B->getValueAsString("LibCallFuncName");
245+
// Sort by libcall impl name and secondarily by the enum name.
246+
sort(AllRuntimeLibcallImpls, [](const Record *A, const Record *B) {
247+
return std::pair(A->getValueAsString("LibCallFuncName"), A->getName()) <
248+
std::pair(B->getValueAsString("LibCallFuncName"), B->getName());
250249
});
251250

252251
RuntimeLibcallImplDefList.reserve(AllRuntimeLibcallImpls.size());

0 commit comments

Comments
 (0)