diff options
author | Chris Lattner <sabre@nondot.org> | 2010-12-15 04:52:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-12-15 04:52:41 +0000 |
commit | ba3c8155704e5e2ac24b5069c32bca359b0738ed (patch) | |
tree | 00b14ed36b3d8120e90546e3ba371b931c5ebd1b /lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 9c6b60eb28d2717008f8d6ff52f7666ebc81113d (diff) |
make qsort predicate more conformant by returning 0 for equal values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121838 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index bbdde4b51f..23a3a25056 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -592,7 +592,11 @@ 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()) ? 1 : -1; + if (LHS->getValue().ult(RHS->getValue())) + return 1; + if (LHS->getValue() == RHS->getValue()) + return 0; + return -1; } /// FoldValueComparisonIntoPredecessors - The specified terminator is a value |