summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-12-13 02:00:58 +0000
committerChris Lattner <sabre@nondot.org>2010-12-13 02:00:58 +0000
commit7c8e6047d6cfdae4fc3933f142e8318aa601a139 (patch)
treea4455466fcb52838e38601d7b8080ed3359f423b /llvm/lib/Transforms
parent1475987634b6943c4077859f3baac27329b2490b (diff)
downloadbcm5719-llvm-7c8e6047d6cfdae4fc3933f142e8318aa601a139.tar.gz
bcm5719-llvm-7c8e6047d6cfdae4fc3933f142e8318aa601a139.zip
convert an std::sort to array_pod_sort.
llvm-svn: 121669
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 8cc63e603ad..912d1d63520 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -29,8 +29,8 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/STLExtras.h"
#include <algorithm>
-#include <functional>
#include <set>
#include <map>
using namespace llvm;
@@ -610,6 +610,12 @@ 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());
+}
+
/// FoldValueComparisonIntoPredecessors - The specified terminator is a value
/// equality comparison instruction (either a switch or a branch on "X == c").
/// See if any of the predecessors of the terminator block are value comparisons
@@ -1985,7 +1991,7 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) {
if (CompVal) {
// There might be duplicate constants in the list, which the switch
// instruction can't handle, remove them now.
- std::sort(Values.begin(), Values.end(), ConstantIntOrdering());
+ array_pod_sort(Values.begin(), Values.end(), ConstantIntSortPredicate);
Values.erase(std::unique(Values.begin(), Values.end()), Values.end());
// Figure out which block is which destination.
OpenPOWER on IntegriCloud