Fix sort predicate. qsort(3)'s predicate semantics differ from std::sort's. Fixes PR 8780.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121705 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer
2010-12-13 18:20:38 +00:00
parent bfc9749f0a
commit cf8b3257c0
2 changed files with 40 additions and 1 deletions
+1 -1
View File
@@ -598,7 +598,7 @@ namespace {
static int ConstantIntSortPredicate(const void *P1, const void *P2) {
const ConstantInt *LHS = *(const ConstantInt**)P1;
const ConstantInt *RHS = *(const ConstantInt**)P2;
return LHS->getValue().ult(RHS->getValue());
return LHS->getValue().ult(RHS->getValue()) ? 1 : -1;
}
/// FoldValueComparisonIntoPredecessors - The specified terminator is a value