[llvm] a1ea9e6 - TableGen: Try to fix expensive checks assert on compare
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 8 02:23:44 PDT 2025
Author: Matt Arsenault
Date: 2025-07-08T18:23:38+09:00
New Revision: a1ea9e632b6db1def1407abcc4c4037144d11eed
URL: https://github.com/llvm/llvm-project/commit/a1ea9e632b6db1def1407abcc4c4037144d11eed
DIFF: https://github.com/llvm/llvm-project/commit/a1ea9e632b6db1def1407abcc4c4037144d11eed.diff
LOG: TableGen: Try to fix expensive checks assert on compare
Attempt to fix regression after #144978
Added:
Modified:
llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
index 81b7d4119d8e5..61eedc077941e 100644
--- a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
+++ b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
@@ -436,12 +436,10 @@ void RuntimeLibcallEmitter::emitSystemRuntimeLibrarySetCalls(
SmallVector<PredicateWithCC, 0> SortedPredicates =
PredicateSorter.takeVector();
- sort(SortedPredicates, [](PredicateWithCC A, PredicateWithCC B) {
- if (!A.Predicate)
- return true;
- if (!B.Predicate)
- return false;
- return A.Predicate->getName() < B.Predicate->getName();
+ llvm::sort(SortedPredicates, [](PredicateWithCC A, PredicateWithCC B) {
+ StringRef AName = A.Predicate ? A.Predicate->getName() : "";
+ StringRef BName = B.Predicate ? B.Predicate->getName() : "";
+ return AName < BName;
});
for (PredicateWithCC Entry : SortedPredicates) {
@@ -472,7 +470,8 @@ void RuntimeLibcallEmitter::emitSystemRuntimeLibrarySetCalls(
// This also makes it annoying to make use of the default set, since the
// entries from the default set may win over the replacements unless
// they are explicitly removed.
- sort(Funcs, [](const RuntimeLibcallImpl *A, const RuntimeLibcallImpl *B) {
+ stable_sort(Funcs, [](const RuntimeLibcallImpl *A,
+ const RuntimeLibcallImpl *B) {
return A->getProvides()->getEnumVal() < B->getProvides()->getEnumVal();
});
More information about the llvm-commits
mailing list