Skip to content

Commit a1ea9e6

Browse files
committed
TableGen: Try to fix expensive checks assert on compare
Attempt to fix regression after #144978
1 parent a1edb1d commit a1ea9e6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,10 @@ void RuntimeLibcallEmitter::emitSystemRuntimeLibrarySetCalls(
436436
SmallVector<PredicateWithCC, 0> SortedPredicates =
437437
PredicateSorter.takeVector();
438438

439-
sort(SortedPredicates, [](PredicateWithCC A, PredicateWithCC B) {
440-
if (!A.Predicate)
441-
return true;
442-
if (!B.Predicate)
443-
return false;
444-
return A.Predicate->getName() < B.Predicate->getName();
439+
llvm::sort(SortedPredicates, [](PredicateWithCC A, PredicateWithCC B) {
440+
StringRef AName = A.Predicate ? A.Predicate->getName() : "";
441+
StringRef BName = B.Predicate ? B.Predicate->getName() : "";
442+
return AName < BName;
445443
});
446444

447445
for (PredicateWithCC Entry : SortedPredicates) {
@@ -472,7 +470,8 @@ void RuntimeLibcallEmitter::emitSystemRuntimeLibrarySetCalls(
472470
// This also makes it annoying to make use of the default set, since the
473471
// entries from the default set may win over the replacements unless
474472
// they are explicitly removed.
475-
sort(Funcs, [](const RuntimeLibcallImpl *A, const RuntimeLibcallImpl *B) {
473+
stable_sort(Funcs, [](const RuntimeLibcallImpl *A,
474+
const RuntimeLibcallImpl *B) {
476475
return A->getProvides()->getEnumVal() < B->getProvides()->getEnumVal();
477476
});
478477

0 commit comments

Comments
 (0)